+ 1
Whats wrong with my bmi project
#BMI project w=float(input()) h=float(input()) if w/h<18.5: print("Underweight") if w/h>=18.5 and <25: print("Normal") elif >25 and <30 print("Overweight") else: >30 print("Obesity")
16 Respuestas
+ 3
Check the bmi formula again and the indentation.
Also I would recommend you to chain the conditions with an if-elif-else construction instead of nesting it
+ 4
#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")
+ 2
There is a better code which you can use
w =float(input())
h =float(input())
bmi = w/h**2
if bmi > 30:
print("Obesity")
elif bmi >= 25:
print("Overweight")
elif bmi >= 18.5:
print("Normal")
else: print("Underweight")
+ 1
w=float(input())
h=float(input())
if w/h<18.5:
print("Underweight")
elif w/h>=18.5 and <25
print("Normal")
elif >25 and <30
print("Overweight")
else: >30 print("Obesity")
+ 1
It is in the task description, read the task description carefully
+ 1
#Here is the way
#your code goes here
weight=float(input())
height=float(input())
bmi= weight/(height)**2 #you need to edit this line on your code
if bmi<18.5:
print("Underweight")
elif bmi>=18.5 and bmi<25:
print("Normal")
elif bmi>=25 and bmi<30:
print("Overweight")
else:
print("Obesity")
+ 1
Use elif
Use indentation properly
0
Can you please show me a comparison
0
Try what I suggested to you
0
👉 LOOK AT THE GIVEN FORMULA FOR BMI
0
Ill reaserach it but thanks
0
Thanks
0
not w/h, w/h**2 edit this line then your code will work
0
Thanks
- 1
Still not working