[Solved] Write a function called findHypot


There are some problems with your code, but let’s look at the output first. You get that output, because you are not calling the function that you defined:

print("The lenght of the hypotenous is",findhypot)

So instead of just putting findhypot in your print you should call it and pass the two paramters that you just received via input:

print("The lenght of the hypotenous is",findhypot(a,b))

But that will give you (assuming your input is 3 and 4):

The lenght of the hypotenous is (3, 4)

Why that? Because you are just returning a and b in your function without any further calculation:

return a , b

Without further calculation? But there is a line doing something with a,b! Yes, but that calculated value is never assigned or returned, so either use a variable to get the result of the calculation:

def findhypot(a , b):
    result = ((a*a)+(b*b)%2)
    return result

Or return the calculation directly:

def findhypot(a , b):
    return ((a*a)+(b*b)%2)

But now you will get 9 as result for 3 and 4. 5 should be the correct value. I leave it up to you to find the soluton for that problem. Hint: Pythagoras, import math and math.sqrt(...)

2

solved Write a function called findHypot