How to correct this statement? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to correct this statement?

1 w = int(input()) 2 h = float(input()) 3 bmi = w / h ** 2 4 if bmi < 18.5: 5 print("underweight") 6 elif bmi >= 18.5: 7 bmi < 25 8 print("normal") 9 elif bmi >= 25: 10 bmi < 30 11 print("overweight") 12 else: 13 print("obesity") It say the elif bmi >18.5 bmi < 25 is wrong. Here what I have put in. I am making program in python that converted weight and height to out put if person overweight or something like that.

21st Jun 2022, 5:18 PM
Cindy Nelson
2 Answers
0
Try translating your code to plain English to test your own logic. That piece of code is currently saying: If the BMI is greater than or equal to 18.5 less than 25. That doesn't sound right does it?
21st Jun 2022, 5:30 PM
Justice
Justice - avatar
0
Cindy Nelson When you change the body of your question, please let us know. With the new code you posted, take a look at line 8-10. Especially for line 9, you have a statement with no condition.
21st Jun 2022, 6:16 PM
Justice
Justice - avatar