+ 4

what's wrong with this BMI Calculator? i can't find any problem but the code output is wrong

weight = int(input('weight in kg: ')) height = float(input('height in meter: ')) BMI = weight/height if BMI < 18.5: print("Underweight") if BMI >= 18.5 or BMI < 25: print("Normal") elif BMI >= 25 or BMI < 30: print("Overweight") elif BMI > 30: print("Obesity")

18th Jan 2022, 12:42 PM
yonas
yonas - avatar
1 ответ
+ 3
yonas First thing don't write anything inside input function. Second thing BMI = weight / height**2 Third thing there should be and instead of or 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") elif BMI>=30: print ("Obesity")
18th Jan 2022, 12:47 PM
A͢J
A͢J - avatar