-3
w=int(input("Enter your weight"))
h=int(input("Enter your height"))
bmi=w/h**2
if (bmi<=18.5):
    print("UnderWeight")
elif (bmi>18.5 and   bmi<=24.9):
    print("Healthy")
elif (bmi>=25 and bmi<=29.9):
    print("OverWeight")
elif (bmi>30):
    print("Obese")

the output is not accurate weight is measured in kgs and height is measured in centimeters please help!

its like weight 65 kgs and height 150 cms it shows under weight it is supposed to be overweight or healthy

1 Answers1

3

For BMI height needs to be in meters and not centimetres . So just make this change

bmi = w / (h/100)**2

or

h /= 100 # or h = h / 100
bmi = w / h**2
Eeshaan
  • 1,557
  • 1
  • 10
  • 22