0

BMI Calculator Problem

height = float(input()) weight = float(input())*2 BMI = weight/height if BMI<=18.5 and BMI<25: print("Underweight") elif BMI >=25 and BMI<30: print("Overweight") elif BMI>30: print("Obesity") elif BMI<18.5: print("Normal") The code above is not working please help

7th Apr 2022, 6:22 PM
Stuart
6 Respostas
+ 4
Look at the bmi formula again. Height must be raised by the power of 2. Also think about the conditions: * if bmi is <= than 18.5, it will naturally be smaller than 25 * bmi < 18.5 would be underweight * what if s.o. has a bmi of exactly 30?
7th Apr 2022, 6:28 PM
Lisa
Lisa - avatar
+ 1
In addition to prior comments, pay attention to the inputs. Code Coach provides weight first, then height.
7th Apr 2022, 8:16 PM
Brian
Brian - avatar
+ 1
Thank you for help, i understand now.
7th Apr 2022, 10:27 PM
Stuart
0
BMI= weight/(height*height) It need power of 2 , not multiply 2 Your code never met condition for Normal.. .. Check your conditions again according to task..
7th Apr 2022, 6:31 PM
Jayakrishna 🇮🇳
0
You need to write **2 instead of *2 so you get the square and not the double
9th Apr 2022, 11:52 AM
Joël Egger
Joël Egger - avatar
- 1
I suggest you to read the lessons about "elif statement" and "powers" again. Don't hesitate to use the app's editor to try some pieces of code.
7th Apr 2022, 9:30 PM
Orisa
Orisa - avatar