0

Guys can someone pls explain me what went wrong with this code?

The project (BMI calculator)In the course (python for beginners)shows wrong even though the inputs were provided.

29th Apr 2021, 12:33 PM
KADHM
KADHM - avatar
5 Answers
+ 1
In first elif statement after or Put x <= 25 And in second one after or Put x <= 30
29th Apr 2021, 2:32 PM
kris
kris - avatar
+ 1
Give input dynamically i.e weight=int(input()) height=float(input ()) x=weight/float(height**2) Also you have to put 'AND' operator ,because you have to satisfy both conditions I.e If x<18.5: Print("Under weight") elif x>=18.5 and x<25: Print("Normal") elif x>=25 and x<30: Print("Over weight") else: Print("Obesity")
29th Apr 2021, 3:09 PM
Durga Devi
Durga Devi - avatar
0
x=1.85**2/52 if x<18.5: print("Under weight") elif x>=18.5 or 25: print("normal") elif x>=25 or 30: print("over weight") else: print("obesity")
29th Apr 2021, 12:34 PM
KADHM
KADHM - avatar
0
Here is the code
29th Apr 2021, 12:34 PM
KADHM
KADHM - avatar
0
Thanks guys
29th Apr 2021, 3:41 PM
KADHM
KADHM - avatar