Exercise: Function return values 1

3.4.3.1. Exercise: Function return values 1#

Write a function called calculate_bmi that takes a person’s height and weight as arguments, and that returns the body-mass index, knowing that \(\text{BMI} = \text{weight}/\text{height}^2\).

Hide code cell content
def calculate_bmi(height, weight):
    return weight / (height ** 2)


# Let's test the function:
print(calculate_bmi(1.5, 50.2))
22.311111111111114