- 1

Why is my BMI calculator returning "Underweight" for weight 120 and height 1.7?

The input is supposed to take weight of 120 a d height of 1.7. Since BMI is greater than 30, in is supposed to print Obesity. But it is printing Undrweight. What am I doing wrong?!

17th Jun 2022, 12:23 PM
Rodney Kawamara
4 odpowiedzi
0
First of all: hard to say without seeing what you actually did so far (please edit your question and insert your code) Moreover: you could maybe print(BMI) to controll whether the calculation is correct or something like this Looking forward to look at your code and give you better hints
17th Jun 2022, 12:34 PM
Alexander Thiem
Alexander Thiem - avatar
0
#This is my code for the BMI Calculator weight = float(input()) height = float(input()) BMI = weight / (height **2) if BMI < 18.5: print("Underweight") elif (BMI >= 18.5) and (BMI < 25): print("Normal") elif (BMI >= 25) and (BMI < 30): print("Overweight") elif (BMI >= 30): print("Obesity") #May need to fix the indentation
17th Jun 2022, 12:48 PM
Rodney Kawamara
0
I copied your code and it printed Obesity for me… Inpout formatted like this: 120 1.7 Did you maybe enter the numbers in the wrong order?
17th Jun 2022, 12:56 PM
Alexander Thiem
Alexander Thiem - avatar
0
I am not sure now. IDLE is outputting Underweight. Maybe I put in the wrong order of numbers.🤔 Thank you so much!😁
17th Jun 2022, 12:58 PM
Rodney Kawamara