First page Back Continue Last page Overview Graphics

Nested Functions

def hypotenuse(cathetus1, cathetus2):

def square(x):

return x * x

def sum(a, b):

return a + b

hyp = sum(square(cathetus1),

square(cathetus2))

return hyp

print("The square of the hypothenuse:", hypotenuse(3, 4))