The Body Mass Index (BMI) is defined as a person's weight in kilograms, divided by the square of their height in meters:
Figure 2.28: Expression for BMI
BMI is a universal way to classify people as underweight
, healthy weight
, overweight
, and obese
, based on tissue mass (muscle, fat, and bone) and height. The following plot indicates the relationship between weight and height for the various categories:
Figure 2.29: Body Mass Index categories (source: https://en.wikipedia.org/wiki/Body_mass_index)
According to the preceding plot, we can build the four categories (underweight
, healthy weight
, overweight
, and obese
) based on the BMI values:
"""
define function for computing the BMI category, based on BMI value
"""
def get_bmi_category(bmi):
if bmi < 18.5:
category = "underweight"
...