+ 2

I think I'm stuck

Height = float(input()) Weight = float(input()) x = "BMI" x = Weight/Height**2 if x < 18.5 : print("Underweight") elif x >= 18.5 and x < 25 : print("Normal") elif x >= 25 and x < 30 : print("Overweight") elif x > 30 : print("Obesity")

17th Mar 2021, 7:54 AM
Gbotemi
Gbotemi - avatar
8 ответов
+ 2
in your first code you have swapped the input: weight should comes before height... it seems that your last post correct this, but as it is not correctly formatted, it's hard to say if you've introduced a new error ;P
17th Mar 2021, 10:25 AM
visph
visph - avatar
+ 1
The math must be wrong. Have you tested yours with one online to see if you get the same results? If not, do that
17th Mar 2021, 8:09 AM
Slick
Slick - avatar
+ 1
you already posted that, if anything, put it in the playground and link the code here. I can't run it from here like this
17th Mar 2021, 8:21 AM
Slick
Slick - avatar
0
Stuck on what? Seems to work fine
17th Mar 2021, 7:59 AM
Slick
Slick - avatar
0
Only test case 1 works
17th Mar 2021, 8:08 AM
Gbotemi
Gbotemi - avatar
0
I don't know why
17th Mar 2021, 8:08 AM
Gbotemi
Gbotemi - avatar
0
I'll try that
17th Mar 2021, 8:10 AM
Gbotemi
Gbotemi - avatar
- 1
weight = float(input()) height = 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') elif bmi >= 30: print('Obesity')
17th Mar 2021, 8:19 AM
Gbotemi
Gbotemi - avatar