0
Pls help me check this, I can't find the error. #BMI calculator
w=int(input()) h=float(input()) Bmi=(w/h**2) if Bmi <18.5: print("Underweight") elif(Bmi <=25): print("Normal") elif(Bmi <=30): print("Overweight") elif(Bmi >=30): print("Obese"
2 odpowiedzi
+ 2
Check your condition again.
For input 25, you print Normal but required is Overweight . Similarly for all.
You need < , instead of <=
And spelling for "Obesity" and close print
+ 1
You missed out the ')' at the end of the program, also, this is how I did it:
BMI=0
weight=float(input()) #weight in Kg
height=float(input()) #height in M
BMI=weight/height**2
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")