+ 1

BMI in Python Quiz

Hi Why this code doesn’t solve python exercise in BMI weight = float(input()) height = float(input()) BMI = (weight/ (height**2)) print (BMI) if (BMI < 18.5): print ("Underweight") elif BMI >= 18.5 and BMI < 25: print ("Normal") elif BMI >= 25 and BMI < 30: print ("Overweight") elif BMI >= 30: print ("Obesity")

13th Jul 2022, 2:37 PM
ahmed shanti
ahmed shanti - avatar
2 Respostas
+ 3
Do not print the bmi, only the category as described in the example below the task description.
13th Jul 2022, 2:42 PM
Lisa
Lisa - avatar
+ 4
Take this if it should work fine you yourself will understand where you went wrong it's simple w = float(input()) h = float(input()) bmi = w/h**2 if bmi <18.5: print("Underweight") elif bmi >=18.5 and bmi <25: print("Normal") elif bmi >=25 and bmi <30: print("Overweight") else: print("Obesity")
13th Jul 2022, 2:45 PM
Eliezer Fajardo
Eliezer Fajardo - avatar