+ 2
Bmi calculator error
w=int(input()) h=float(input()) bmi= w / (h*h) if bmi< 18.5: print ("Underweight") elif bmi<= 18.5 and bmi< 25.0: print ("Normal") elif bmi>=25.0 and bmi<30.0: print ("Overweight") else: print ("Obesity")
3 Answers
+ 3
Should be
elif bmi >= 18.5 and bmi< 25.0
+ 5
As has been pointed out, the <= should be >=. There is no need to test >= after you already tested <. Just remove the redundant logic and mistakes like that won't happen.
w=int(input())
h=float(input())
bmi= w / (h*h)
if bmi< 18.5:
print ("Underweight")
elif bmi< 25.0:
print ("Normal")
elif bmi<30.0:
print ("Overweight")
else:
print ("Obesity")