+ 2
BMI
Hi, i m having troubles to pass the exercise. 4 out of 5 attemps are well done but don't know why si wrong weight = int(input()) height = float(input()) BMI = weight / (height**2) if (BMI<18.5): print ("Underweight") elif ((BMI >= 18.5) and (BMI <=24.9)): print ("Normal") elif ((BMI >=25) and (BMI <= 29.9)): print ("Overweight") elif (BMI >=30): print ("Obesity")
4 Respostas
+ 6
You need to change your 1st and 2nd elif statements.
BMI<25
BMI<30
+ 3
Thanks a Lot, that was the problema xD
+ 2
This works
#your code goes here
w = float (input())
h = float (input())
bmi = w/h**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("Obesity")
+ 1
weight = int(input())
height = float(input())
bmi = weight/(height*height)
if bmi <18.5:
print('Underweight')
elif bmi >30:
print('Obesity')
elif bmi <25 >18.5:
print('Normal')
elif bmi >25 <30:
print('Overweight')
this worked.