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")

16th Apr 2021, 10:47 AM
NattaN 45
NattaN 45 - avatar
5 Antworten
+ 10
Nattan , please give a clear description what our problem is. what kind of problem or error you are encountered? thanks!
16th Apr 2021, 11:03 AM
Lothar
Lothar - avatar
+ 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!
16th Apr 2021, 11:09 AM
Coding Cat
Coding Cat - avatar
+ 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")
16th Apr 2021, 11:54 AM
Coding Cat
Coding Cat - avatar
+ 2
Thanks bro it was the = sign and the float nos usen in if
16th Apr 2021, 12:12 PM
NattaN 45
NattaN 45 - avatar
+ 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
16th Apr 2021, 11:39 AM
NattaN 45
NattaN 45 - avatar