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
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?
+ 1
In addition to prior comments, pay attention to the inputs. Code Coach provides weight first, then height.
+ 1
Thank you for help, i understand now.
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..
0
You need to write **2 instead of *2 so you get the square and not the double
- 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.