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")
7 odpowiedzi
+ 2
Actually thought the same but that lead to an error.
I found the solution actually. I used height first instead of weight
0
Your weight shoulb be int not float because in bmi practice the value used is int type not float
0
I think that is the reason, it didn't work in sololearn app
0
Yeah of course, good so
0
Yes because bmi = w/h**2
Need weight in first
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
0
Yeah