+ 1

Whats wrong with my bmi project

#BMI project w=float(input()) h=float(input()) if w/h<18.5: print("Underweight") if w/h>=18.5 and <25: print("Normal") elif >25 and <30 print("Overweight") else: >30 print("Obesity")

6th Feb 2022, 9:51 AM
Faramarz Nazari
16 Answers
+ 3
Check the bmi formula again and the indentation. Also I would recommend you to chain the conditions with an if-elif-else construction instead of nesting it
6th Feb 2022, 10:27 AM
Lisa
Lisa - avatar
+ 4
#TRY THIS #Use your indentation properly w =float(input()) h =float(input()) bmi = w/h**2 if bmi < 18.5: print("Underweight") elif bmi >= 18.5 and w/h <25: print("Normal") elif bmi >=25 and w/h <30; print("Overweight") else: print("Obesity")
6th Feb 2022, 6:42 PM
Anshuman Routray
Anshuman Routray - avatar
+ 2
There is a better code which you can use w =float(input()) h =float(input()) bmi = w/h**2 if bmi > 30: print("Obesity") elif bmi >= 25: print("Overweight") elif bmi >= 18.5: print("Normal") else: print("Underweight")
8th Feb 2022, 3:32 PM
Anshuman Routray
Anshuman Routray - avatar
+ 1
w=float(input()) h=float(input()) if w/h<18.5: print("Underweight") elif w/h>=18.5 and <25 print("Normal") elif >25 and <30 print("Overweight") else: >30 print("Obesity")
6th Feb 2022, 10:44 AM
Faramarz Nazari
+ 1
It is in the task description, read the task description carefully
6th Feb 2022, 10:48 AM
Lisa
Lisa - avatar
+ 1
#Here is the way #your code goes here weight=float(input()) height=float(input()) bmi= weight/(height)**2 #you need to edit this line on your code if bmi<18.5: print("Underweight") elif bmi>=18.5 and bmi<25: print("Normal") elif bmi>=25 and bmi<30: print("Overweight") else: print("Obesity")
8th Feb 2022, 2:16 AM
Ferhat FIRAT
Ferhat FIRAT - avatar
+ 1
Use elif Use indentation properly
8th Feb 2022, 9:18 AM
Chathushka Ayash
Chathushka Ayash - avatar
0
Can you please show me a comparison
6th Feb 2022, 10:28 AM
Faramarz Nazari
0
Try what I suggested to you
6th Feb 2022, 10:30 AM
Lisa
Lisa - avatar
0
๐Ÿ‘‰ LOOK AT THE GIVEN FORMULA FOR BMI
6th Feb 2022, 10:45 AM
Lisa
Lisa - avatar
0
Ill reaserach it but thanks
6th Feb 2022, 10:45 AM
Faramarz Nazari
0
Thanks
6th Feb 2022, 10:49 AM
Faramarz Nazari
0
not w/h, w/h**2 edit this line then your code will work
7th Feb 2022, 10:02 PM
Ferhat FIRAT
Ferhat FIRAT - avatar
0
Thanks
8th Feb 2022, 2:09 AM
Faramarz Nazari
- 1
Still not working
6th Feb 2022, 10:44 AM
Faramarz Nazari