Python
Invent your own function that does some useful computation of your choosing. Do not copy the function from somewhere else. Use incremental development, and record each stage of the development process as you go. Finally, print output that demonstrates that the function works as you intended.
Include all of the following: An explanation of each stage of development, including code and any test input and output. The output of three calls to your function with different arguments.
Given below is the code in python to calculate hypotenuse of a triangle given two others as the parameters:
import math # math library is used
for the sqrt (squareroot) function.
def hypotenuseOfTriangle(x,y): # functon declaration with x and y
as the parameters
return math.sqrt(x*x+y*y) # return sqrt of x^2 + y^2
print(hypotenuseOfTriangle(3,7)) # function call where 3 amd 4 are
the parameters
Get Answers For Free
Most questions answered within 1 hours.