Reading Time: 1 minutes
Calculate your Body Mass Index (BMI) in Python: Python script to calculate your Body Mass Index (BMI).
Calculate your Body Mass Index (BMI) in Python
# Body Mass Index (BMI) is a value obtained from height and weight of an individual. It is used as a metric to classify a person as underweight, normal weight, overweight or obese based on the computed value.
# BMI for underweight: < 22.5
# BMI for normal-weight: 22.5–25
# BMI for overweight: 25–29.9
# BMI = ( weight / height * height ) * 703 when weight is in pounds (lbs) and height is in inches
# BMI = ( weight / height * height ) when weight is in kilograms and height is in meters
# We will use the second formula to calculate BMI here. You can use the first one by changing the units.
print("How tall are you in feet and inches?")
feet = int(input("Feet: "))
inches = float(input("Inches: "))
h = ( ( feet * 12 + inches ) * 2.54 ) / 100
w = int(input("How much do you weigh in kilograms? "))
print("Your BMI:", w / (h * h) )
Try it here.







