0
plz anyone can tell what i am doing wrong to calculate BMI CALCULATER in Python for BEGINNERS COURSE
weight = int(input()) height = float(input()) BMI = weight/(height**2) if BMI< 18.5: print("Underweight") if BMI>= 18.5 and BMI<25: print("Normal") if BMI>= 25 and BMI<30: print("Overweight") if BMI>=30: print("Obesity")
5 Respuestas
+ 1
weight = int(input())
height = float(input())
BMI = weight/(height**2)
if BMI< 18.5:
print("Underweight")
if BMI>= 18.5 and BMI<25:
print("Normal")
if BMI>= 25 and BMI<30:
print("Overweight")
if BMI>=30:
print("Obesity")
+ 2
Get that by elif once its true it breaks by if not
+ 1
Indentation error . It is a common mistake for many python beginners .
https://appuals.com/fix-indentation-error-python/
Hope this helps you
+ 1
Atul [Inactive]
Canyou explain y if is good i wuld think it shuld be elif
+ 1
If is checking all the conditions even if the condition is true which is not done by elif