0
Bmi calculator final project on python for beginners
What did I do wrong? Iâve edited three different times and still not working. I even changed the or to and. This is my code. weight = int(input()) height = float(input()) bmi = weight/(height**weight) if (bmi<18.5): print("underweight") elif (bmi>=18.5 or <25.0): print("normal") elif (bmi>=25.0 or <30.0): print("overweight") elif (bmi>=30.0): print("obesity") Can someone please help me even my notes are starting to not make sense.
7 Answers
+ 2
Simon Sauter i figured it out. It was
weight = int(input())
height = float(input())
bmi = weight/height**2
if (bmi < 18.5):
print("Underweight")
elif (bmi >= 18.5) and (bmi < 25.0):
print("Normal")
elif (bmi >= 25.0) and (bmi < 30.0):
print("Overweight")
elif (bmi >= 30.0):
print("Obesity")
Thank you so much for your help.
+ 1
1. Unident the elif statements.
2. Your outputs have to start with a capital letter (e.g. "Obesity").
3. bmi = weight/height**2
+ 1
Simon Sauter okay i tried that and still have error this is the new version is there anything else im not noticing?
weight = int(input())
height = float(input())
bmi = weight/height**2
if (bmi < 18.5):
print("Underweight")
elif (bmi >= 18.5 or < 25.0):
print("Normal")
elif (bmi >= 25.0 or < 30.0):
print("Overweight")
elif (bmi >= 30.0):
print("Obesity")
+ 1
In the second and third elif statements replace "or" with "and".
+ 1
Simon Sauter changed it and still not working :/ heres the updated version.
weight = int(input())
height = float(input())
bmi = weight/height**2
if (bmi < 18.5):
print("Underweight")
elif (bmi >= 18.5 and < 25.0):
print("Normal")
elif (bmi >= 25.0 and < 30.0):
print("Overweight")
elif (bmi >= 30.0):
print("Obesity")
+ 1
Try with weight as float instead of int.
0
#TRY THIS
#Use your indentation properly
w =float(input())
h =float(input())
bmi = w/h**2
if bmi < 18.5:
print("Underweight")
elif bmi >= 18.5 and w/h <25:
print("Normal")
elif bmi >=25 and w/h <30;
print("Overweight")
else: print("Obesity")