plz anyone can tell what i am doing wrong to calculate BMI CALCULATER in Python for BEGINNERS COURSE | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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")

12th Oct 2021, 8:26 AM
Jaykumar Lokhande
Jaykumar Lokhande - avatar
5 Réponses
+ 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")
12th Oct 2021, 8:56 AM
Atul [Inactive]
+ 2
Get that by elif once its true it breaks by if not
13th Oct 2021, 1:24 AM
Lz1234
+ 1
Indentation error . It is a common mistake for many python beginners . https://appuals.com/fix-indentation-error-python/ Hope this helps you
12th Oct 2021, 8:58 AM
Atul [Inactive]
+ 1
Atul [Inactive] Canyou explain y if is good i wuld think it shuld be elif
12th Oct 2021, 6:29 PM
Lz1234
+ 1
If is checking all the conditions even if the condition is true which is not done by elif
13th Oct 2021, 1:05 AM
Atul [Inactive]