please tell me how to make a python program no. 3
please it's very urgent tomorrow is my exam pleaseeeeeee
Answers
Heya friend,
First of all :-
B.M.I. can never be calculated for heights in cm, the formula is for heights in m.
So,
Here we go,
If we see the BMI parameters they are like -
BMI Index < 18.5 ⇒ underweight
18.5 < BMI Index < 24.9 ⇒ normal
24.9 < BMI Index < 29.9 ⇒ overweight
29.9 and above ⇒ obese
Now, let's see the source code:
SOURCE CODE
#B.M.I. calculator
w=float(input('Enter weight in kilograms:'))
h=float(input('Enter height in meters:'))
BMI=w/h**2
if BMI>0:
if BMI<18.5:
print('underweight')
elif BMI<=24.9:
print('normal')
elif BMI<=29.9:
print('overweight')
else:
print('obese')
else:
print('invalid BMI')
OUTPUT
>>>
Enter weight in kilograms:75
Enter height in centimetres:1.88
normal
>>>
>>>
Enter weight in kilograms:85
Enter height in centimetres:1.88
normal
>>>
>>>
Enter weight in kilograms:100
Enter height in centimetres:1.88
overweight
>>>
Enter weight in kilograms:55
Enter height in centimetres:1.78
underweight
>>>
>>>
Enter weight in kilograms:88
Enter height in centimetres:1.65
obese
>>>
Thanks !
#BAL #answerwithquality