0
What's wrong int this code? (python)
weight = int(input("Your weight: ")) height = int(input("Your height: ")) total_height = height * height BMI = weigth / total_height if BMI < 18.5: print("Underweight") elif BMI >= 18.5 and < 25: #what's wrong in this line? print("Normal") elif BMI >= 25 and < 30: print("Overweight") elif BMI > 30: print("Obesity")
3 Respuestas
+ 2
You should write:
Elif BMI >= 18.5 and BMI < 25:
and the same at next line
+ 2
Here are some (correct) ways you can write that line:
elif BMI >= 18.5 and BMI<25:
elif 25>BMI>=18.5:
elif 18.5<=BMI<25:
elif BMI<25:
The last one should be preferred over the others as the first condition (18.5 <= BMI) is already satisfied by the else part in elif
+ 1
Zeref Dragneel
You have already received some good answers, but there are 2 other problems.
1. Line 4 -> weight is spelt incorrectly which means the variable will not be called.
2. What happens if the BMI ==30?
Your code does not cover this.
You are close to resolving this.
keep going, good luck