-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Expand file tree
/
Copy pathBMI calculator.py
More file actions
49 lines (36 loc) · 1.63 KB
/
BMI calculator.py
File metadata and controls
49 lines (36 loc) · 1.63 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
print('\t\t\t BMI Calculator')
print('\t\t\t By Abdinasir Hussein')
print('\n Hello, this is a BMI Calculator!')
input('Do you wish to enter metric units or imperial units: ')
while input == 'metric':
height = float(input('Please enter your height input meters(decimals): '))
weight = int(input('Please enter your weight input kg: '))
bmi = weight/(height*height)
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,'overweight.')
elif bmi > 30:
print('Your BMI is', bmi,'which means you are obese.')
else:
print('There is an error with your input')
print('Please check you have entered whole numbers\n'
'and decimals were asked.')
while input == 'imperial':
height = int(input('Please enter your height input inputches(whole number): '))
weight = int(input('Please enter your weight input pounds(whole number): '))
bmi = (weight*703)/(height*height)
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:
print('Your BMI is', bmi,'which means you are obese.')
else:
print('There is an error with your input')
print('Please check you have entered whole numbers\n'
'and decimals were asked.')