Wednesday, 18 September 2013

Python if statement troubleshooting

Python if statement troubleshooting

Python Version : 2.7
Just wondering what is wrong with the following code :
def bmi_cat(bmi):
if bmi < 18.5:
return "underweight"
elif (bmi >=18.5 or bmi < 25):
return "normal"
elif (bmi >=25 or bmi < 30):
return "overweight"
else:
return "obese"
Basically if i enter 17 it gives me the correct answer, but it gives me
normal for anything above 18.5 (3000 gives normal instead of obese,etc...)

No comments:

Post a Comment