+ 1

Python BMI calculator exercise

Hi, someone knows why this BMI calculator is wrong? Four of the five test case results give well less one that is hidden, I can't find the error: weight = int(input()) height = float(input()) BMI = weight / height ** 2 if BMI < 18.5: print("Underweight") elif BMI >= 18.5 and BMI <= 24.9: print("Normal") elif BMI >= 25 and BMI <= 29.9: print("Overweight") elif BMI >= 30: print("Obesity")

18th Jul 2021, 9:00 PM
Irene Ovadia
2 Antworten
+ 2
Shouldn't <= 24.9 not be < 25. And <= 29.9 not be < 30
18th Jul 2021, 9:28 PM
Paul
Paul - avatar
+ 1
You are right, thank you!
18th Jul 2021, 9:38 PM
Irene Ovadia