0

Why is my code giving error?(BMI calculator from python for beginners project)

height = float(input()) weight = float(input()) bmi = weight / float(height*height) 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")

7th Nov 2021, 7:21 AM
Ngawang Zangphel
Ngawang Zangphel - avatar
4 Answers
+ 4
And check the sample input again: 1. Input weight 2. Input height
7th Nov 2021, 8:09 AM
Lisa
Lisa - avatar
+ 4
Ngawang Zangphel Your code works but won't pass the challenge tests because your outputs don't meet the challenge requirements. All outputs must have a capital letter. underweight -> Underweight normal -> Normal PS: bmi = weight / height**2 cleaner coding
7th Nov 2021, 7:54 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Hi! I tried your code, but got no errors? For example: >>> 1.9 >>> 70 normal
7th Nov 2021, 7:49 AM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Lisa Excellent point!
7th Nov 2021, 8:11 AM
Rik Wittkopp
Rik Wittkopp - avatar