Pls help me check this, I can't find the error. #BMI calculator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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"

18th Feb 2022, 10:26 AM
Essien Bukola
Essien Bukola - avatar
2 Answers
+ 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
18th Feb 2022, 10:59 AM
Jayakrishna 🇮🇳
+ 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")
19th Feb 2022, 3:28 PM
Bubble Tea
Bubble Tea - avatar