-
Notifications
You must be signed in to change notification settings - Fork 0
/
BMI calculator.py
35 lines (33 loc) · 1.12 KB
/
BMI calculator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
height = float(input("Your height in metres:"))
weight = int(input("Your weight in kilograms:"))
bmi = round(weight/ (height * height),2)
if bmi <= 18.5:
print('Your BMI is', bmi, 'which means you are underweight.')
elif bmi > 18.5 and bmi < 25:
print('Your BMI is', bmi, 'which means you are normal.')
elif bmi > 25 and bmi < 30:
print('Your BMI is', bmi, 'which means you are overweight.')
elif bmi > 30 and bmi <35:
print('Your BMI is', bmi, 'which means you are obese.')
elif bmi > 35 :
print('Your BMI is', bmi, 'which means you are extremely obese.')
else:
print('There is an error with your input')
#or
def test(x,y):
return round(x/(y*y),2)
c=int(input("Weight (kg):"))
d=float(input('Height (m):'))
print('BMI:',test(c, d))
if test(c,d) <= 18.5:
print('You are under weight')
elif test(c,d) > 18.5 and test(c,d) < 25:
print('You are normal')
elif test(c,d) > 25 and test(c,d) < 30:
print('You are overweight')
elif test(c,d) > 30 and test(c,d) <35:
print('You are obese')
elif test(c,d) > 35 :
print('You are extremely obese')
else:
print('There is an error with your input')