Part 1
Section 6.2 of your textbook describes incremental development. Do the exercise at the end of that section:
As an exercise, use incremental development to write a function called hypotenuse that returns the length of the hypotenuse of a right triangle given the lengths of the other two legs as arguments. Record each stage of the development process as you go. (Downey, 2015)
After the final stage of development, print the output of hypotenuse(3, 4) and two other calls to hypotenuse with different arguments.
Include all of the following in your Learning Journal:
def hypotenus(adj, opp):
hyp = (adj**2 + opp**2) ** 0.5
return hyp
hypotenus(3,4)
5.0
hypotenus(6,8)
10.0
Comments
Leave a comment