In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of November 2nd
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #04 exercise sheet]
In this problem you should submit a function as described. Inside the function do not print anything that was not asked!
Pythagoras discovered that for a right triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides. Let's calculate the length of the hypotenuse given the two smaller sides of a right triangle!
Write a function hypotenuse(a, b) that, given the lengths of two sides a and b of a right triangle, returns the length of the hypotenuse.
The following limits are guaranteed in all the test cases that will be given to your program:
1 ≤ |a|, |b| ≤ 1000 | The lengths of the triangle sides |
Example Function Calls | Example Output |
print( round(hypotenuse(3, 4), 2) ) print( round(hypotenuse(783, 42), 2) ) print( round(hypotenuse(36.5, 8.72), 2) ) |
5.0 784.13 37.53 |