9 Answers
New Answerbmi = float(input()/float(input())**2 if bmi <18.5 : print('Underweight.') elif bmi >=18.5 and <25 : print('Normal.') elif bmi >=25 and <30 : print('Overweight.') else : print('Obesity.')
5/23/2022 9:39:43 PM
Ruan9 Answers
New AnswerNot really. The test case just expects your output without any other punctuation marks. E.g "Underweight" and not "Underweight." They are different outputs
#try this weight = float(input()) height = float(input()) bmi = weight / height**2 if bmi < 18.5: print("Underweight") elif 18.5 <= bmi < 25: print("Normal") elif 25 < bmi < 30: print("Overweight") else: print("Obesity")
Emeh Matthew Man, i want to thank you. I stopped this course months ago because i couldn't solve this and now tou save me. π±
I think we applied the same logic. You just made some errors like: - Including a period (.) in your print statements - Your elif conditions were wrongly written. bmi >= 18.5 and < 25 is invalid syntax. Instead say bmi >= 18.5 and bmi < 25 or more compactly 18.5 <= bmi < 25. Asides these, your logic is correct
Changes bmi = float(input()) / float(input())**2 elif 18.5 <= bmi < 25: print("Normal") elif 25 <= bmi < 30:print("Overweight")
Emeh Matthew So this dot (.) refers to somenthing? Lol. It's more hard than i tought. Thanks, man.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message