Problem with BMI calculator task | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Problem with BMI calculator task

So I have a problem that says that my “Obesity” can not be calculated, it is calculated as “Underweight” instead Height=int(input()); Weight=float(input()); x=Weight/float(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")

23rd Mar 2021, 2:45 PM
Vladislav Umanets
Vladislav Umanets - avatar
2 Answers
+ 4
You need to use float() for height. According to the task, Weight should be the first input variable Weight=float(input()) Height = float(input())
23rd Mar 2021, 3:05 PM
Simba
Simba - avatar
+ 1
Simba thanks!!
24th Mar 2021, 11:31 AM
Vladislav Umanets
Vladislav Umanets - avatar