Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started