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')
12 Answers
+ 3
Why height/100?
Also, output should be same as expected. I mean upper lower case matters
+ 2
weight
height
+ 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')
0
May I know what is the error in it?
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')
0
Even now also I can't get the output
0
No I didn't get the output
0
Whatever the input it shows only underweight
0
😭😭😭
0
I change the initial of your first code for this:height=int(input())#cm
weight=int(input())#kg. It works well.
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")
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")