Question: Part I Exercise 1 As we have seen functions, we advise you to practice at home and convert all the previous programs to functions. Given

Part I Exercise 1 As we have seen functions, we advise you to practice at home and convert all the previous programs to functions. Given the time limitation during the lab, we only ask you to convert exercise 1 from the previous lab to a function by defining a function pythagoras that takes two arguments a and b (as on the figure) and returns c the length of the hypothenuse. You should also add comprehensive docstring (see sample run). Your function should not display anything, but you should call the function from the main program to test it. Sample runs: Enter the size of the first leg: 3 Enter the size of the second leg: 4 The hypothenuse of a right triangle which legs measure 3.0 and 4.0 is 5.0 help(pythagoras) Help on function pythagoras in module _ main__: pythagoras (a, b) Direct application of Pythagoras theorem. Computes the length of the hypothgenuse of a right triangle given the length of the two legs" Parameters: a (float): length of the first leg b (float): length of the second leg Returns: c (float): length of the hypothenuse
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
