0

The result for last operation is no output why??

weight = int(input()) height = float(input()) BMI = weight / (height**2) if BMI < 18.5: print("Underweight") if BMI >= 18.5: if BMI < 25: print("Normal") if BMI >= 25: if BMI < 30: print("Overweight") if BMI >= 30: print("Obesity")

15th Oct 2021, 5:49 AM
Tareq Elgezawy
Tareq Elgezawy - avatar
2 ответов
+ 2
Correct code indentation is crucial in Python, if you don't indent your code properly, you'll always end up getting a problem. Read this code (not to run it) to understand about what and how to make proper indentation. https://code.sololearn.com/cT5BRIbkia21/?ref=app
15th Oct 2021, 6:13 AM
Ipang
+ 1
Tareq Elgezawy You have written nested if block so in this case if 1 case failed then another case will not execute. You have to use elif here.
15th Oct 2021, 6:17 AM
A͢J
A͢J - avatar