0
Now i am so angry with this code ..please help wheres my problem.. i need to make a bmi calculator and i wrote this
weight = float(input()) height = float(input()) bmi = weight/(height)**2 if bmi <= 18.5: print("Underweight") elif bmi <= 24.9: print("Normal") elif bmi <= 29.9: print("Overweight") elif bmi >= 30: print ("Obesity")
5 Antworten
+ 10
Nattan , please give a clear description what our problem is. what kind of problem or error you are encountered?
thanks!
+ 4
Check correct spelling of:
Underweight
Normal
Overweight
Obesity
Use correct upper/lower case for your output.
Height will be used in meters, don't divide it by 100!
+ 4
Underweight = less than 18.5
Normal = more or equal to 18.5 and less than 25
Overweight = more or equal to 25 and less than 30
Obesity = 30 or more
Maybe you try it as descriped above:
if bmi < 18.5:
print("Underweight")
elif bmi < 25:
print("Normal")
elif bmi < 30:
print("Overweight")
else:
print ("Obesity")
+ 2
Thanks bro it was the = sign and the float nos usen in if
+ 1
weight = float(input())
height = float(input())
bmi = weight/(height)**2
if bmi <= 18.5:
print("Underweight")
elif bmi <= 24.9:
print("Normal")
elif bmi <= 29.9:
print("Overweight")
elif bmi >= 30:
print ("Obesity")
I just rearrang it then on the result side it test the code 5 times and the code passes 1,2,3 and 5 test but not the 4 test .... what did i miss