0
BMI calculator
Someone help me out. I tried running this project and one of the test is still wrong...and I can't find the bug. w = int(input()) h = float(input()) BMI = w/h**2 if BMI <= 18.4: print("Underweight") elif BMI <= 24.9: print("Normal") elif BMI <= 29.9: print("Overweight") elif BMI >= 30: print("Obesity")
4 Answers
+ 2
Your problem is associated with your declarations of weight.
IE:
if BMI <= 18.4, etc.
the challenge specifies if BMI <18.5.
So if BMI == 18.475
Your code will return "Normal" instead of "Underweight"
Write your code to reflect the challenge parameters.
Good luck!
+ 1
Thank you so much Rik Wittkopp
I have gotten it correctly...
weight = int(input())
height = float(input())
bmi = weight/(height**2)
if bmi < 18.5:
print('Underweight')
elif bmi >= 18.5 and bmi < 25:
print('Normal')
elif bmi >= 25 and bmi < 30:
print('Overweight')
elif bmi >= 30:
print('Obese')
0
It still has bug..it is project 28 in Python...
But when I run the code in pydriod programming or anaconda, it runs completely