0

BMI-Python calculator project

Can you help me with the Python BMI Calculator project? My code only satisfies 4 tests out of 5, this is my code weight = int(input()) height= float(input()) BMI = weight / (height) ** 2 if BMI < 18.5: print("Underweight") elif 18.5 < BMI < 24.9: print("Normal") elif 25 < BMI < 29.9: print("Overweight") elif BMI > 29: print("Obesity")

11th Jul 2022, 5:51 AM
Aron Gutierrez
Aron Gutierrez - avatar
1 Answer
+ 5
It should be less than 25 instead of 24.9 18.5 on second condition, 25 on third condition are inclusive so use <= instead. elif 18.5 <= BMI < 25: ... elif 25 <= BMI < 30: ... Also on the last condition you should change it to >= 30 đŸ”č x >= 30 is different from x > 29 especially if x is a decimal number (like BMI) elif BMI >= 30: print("Obesity")
11th Jul 2022, 6:03 AM
noteve
noteve - avatar