BMI Calculator Code Project, Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

BMI Calculator Code Project, Python

Can someone please tell me what is wrong with my code? First test case passes, but second case fails as it says my code outputs underweight when it should be obesity. I don’t understand how. height=float(input()) weight=float(input()) BMI=weight/(height**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')

2nd Aug 2022, 5:38 PM
Erin Eickhoff
2 Answers
+ 4
Input order looks wrong. First weight then height, my sample input was: Sample Input 85 1.9
2nd Aug 2022, 5:46 PM
Paul
Paul - avatar
+ 1
Thank you, that was it!
2nd Aug 2022, 5:47 PM
Erin Eickhoff