+ 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")
2 Answers
+ 3
Do not print the bmi, only the category as described in the example below the task description.
+ 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")