0

BMI Calculator gives wrong output even though its correct

I have the correct Code, tested it in VSCode to really make sure my outputs are correct. Yet the App shows its not working. Could someone help me out? Here is my Code: height = float(input()) weight = float(input()) BMI = weight/(height**2) if BMI < 18.5: print("Underweight") elif BMI < 25: print("Normal") elif BMI < 30: print("Overweight") else: print("Obesity")

21st Oct 2021, 9:25 PM
Till Zaydowicz
7 Answers
+ 2
Actually thought the same but that lead to an error. I found the solution actually. I used height first instead of weight
21st Oct 2021, 9:41 PM
Till Zaydowicz
0
Your weight shoulb be int not float because in bmi practice the value used is int type not float
21st Oct 2021, 9:33 PM
ola Scar
ola Scar - avatar
0
I think that is the reason, it didn't work in sololearn app
21st Oct 2021, 9:35 PM
ola Scar
ola Scar - avatar
0
Yeah of course, good so
21st Oct 2021, 9:42 PM
ola Scar
ola Scar - avatar
0
Yes because bmi = w/h**2 Need weight in first
21st Oct 2021, 9:43 PM
ola Scar
ola Scar - avatar
0
Yeah, on my python i just did it with variables for weight and height, but put the math correctly. Sololearn App cannot adept to it
21st Oct 2021, 9:45 PM
Till Zaydowicz
0
Yeah
21st Oct 2021, 9:48 PM
ola Scar
ola Scar - avatar