0
Pls help to find out the problem
#your code goes here w = int(input ()) h = float(input ()) bmi = float (w / h**2) if bmi<18.5 : print ("Underweight") elif 18.5=>bmi<25 : print ("Normal") elif 25=>bmi<30 : print ("Overweight") else 30=>bmi : print ("Obesity")
3 ответов
+ 2
Mistakes:
1. it's >= not =>
2. u can't use condition on else statement for that u can use elif
code:
w = int(input ())
h = float(input ())
bmi = float (w / h**2)
if bmi<18.5 :
print ("Underweight")
elif 18.5>=bmi<25 :
print ("Normal")
elif 25>=bmi<30 :
print ("Overweight")
elif 30>=bmi :
print ("Obesity")
+ 1
But wrong logic is applied in conditions.
They need to be like this
num1 <= bmi < num2:
0
Thanks