0

Hi, I have a doubt in BMI calculator questions. I have wrote a code. But it doesn't show the correct output. Please guide me

height=float(input()) weight=float(input()) bmi = weight/(height/100)**2 print(bmi) if bmi<18.5: print('underweight') elif bmi<25: print('normal') elif bmi<30: print('overweight') else: print('obisity')

22nd Feb 2022, 3:29 PM
Indhu Mathi
12 odpowiedzi
+ 3
Why height/100? Also, output should be same as expected. I mean upper lower case matters
22nd Feb 2022, 3:31 PM
Simba
Simba - avatar
+ 2
weight height
22nd Feb 2022, 3:41 PM
Simba
Simba - avatar
+ 1
height=float(input()) weight=float(input()) bmi = weight/(height)**2 if bmi<18.5: print('Underweight') elif bmi<25: print('Normal') elif bmi<30: print('Overweight') else: print('Obesity')
22nd Feb 2022, 3:36 PM
Indhu Mathi
0
May I know what is the error in it?
22nd Feb 2022, 3:30 PM
Indhu Mathi
0
#your code goes here height=float(input()) weight=float(input()) bmi = weight/(height)**2 print(bmi) if bmi<18.5: print('Underweight') elif bmi<25: print('Normal') elif bmi<30: print('Overweight') else: print('Obisity')
22nd Feb 2022, 3:33 PM
Indhu Mathi
0
Even now also I can't get the output
22nd Feb 2022, 3:34 PM
Indhu Mathi
0
No I didn't get the output
22nd Feb 2022, 3:37 PM
Indhu Mathi
0
Whatever the input it shows only underweight
22nd Feb 2022, 3:39 PM
Indhu Mathi
0
😭😭😭
22nd Feb 2022, 3:42 PM
Indhu Mathi
0
I change the initial of your first code for this:height=int(input())#cm weight=int(input())#kg. It works well.
22nd Feb 2022, 4:02 PM
Cristian Baeza Jimenez
Cristian Baeza Jimenez - avatar
0
Indhu Mathi Here's how to solve it. weight = float(input()) height = float(input()) BMI = weight / height**2 if (BMI <= 18.5): print("Underweight") elif (BMI >=18) and (BMI < 25): print("Normal") elif (BMI >= 25 )and (BMI < 30): print("Overweight") elif (BMI >= 30): print("Obesity")
23rd Feb 2022, 10:44 AM
Aurora Borealis
Aurora Borealis - avatar
0
weight = int(input()) hight = float(input()) total = weight/(hight**2) if total < 18.5: print("Underweight") elif total >= 18.5 and total < 25: print("Normal") elif total >= 25 and total < 30: print("Overweight") elif total >= 30: print("Obesity")
23rd Feb 2022, 8:08 PM
DiFenz