Skip to content

Commit f3b17d8

Browse files
authored
Merge pull request #21 from RajkumarDake/main
Created code in python for body mass index sloved #14
2 parents db24012 + 9cf49a1 commit f3b17d8

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

code-for-body-mass-index.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Code by Rajkumar Dake
2+
// Code in Python of body mass index
3+
print('\t\t\t BMI Calculator')
4+
print('\t\t\t By Abdinasir Hussein')
5+
print('\n Hello, this is a BMI Calculator!')
6+
7+
input('Do you wish to enter metric units or imperial units: ')
8+
9+
while input == 'metric':
10+
height = float(input('Please enter your height input meters(decimals): '))
11+
weight = int(input('Please enter your weight input kg: '))
12+
bmi = weight/(height*height)
13+
14+
if bmi <= 18.5:
15+
print('Your BMI is', bmi,'which means you are underweight.')
16+
17+
elif bmi > 18.5 and bmi < 25:
18+
print('Your BMI is', bmi,'which means you are normal.')
19+
20+
elif bmi > 25 and bmi < 30:
21+
print('your BMI is', bmi,'overweight.')
22+
23+
elif bmi > 30:
24+
print('Your BMI is', bmi,'which means you are obese.')
25+
26+
else:
27+
print('There is an error with your input')
28+
print('Please check you have entered whole numbers\n'
29+
'and decimals were asked.')
30+
31+
while input == 'imperial':
32+
height = int(input('Please enter your height input inputches(whole number): '))
33+
weight = int(input('Please enter your weight input pounds(whole number): '))
34+
bmi = (weight*703)/(height*height)
35+
36+
if bmi <= 18.5:
37+
print('Your BMI is', bmi,'which means you are underweight.')
38+
39+
elif bmi > 18.5 and bmi < 25:
40+
print('Your BMI is', bmi,'which means you are normal.')
41+
42+
elif bmi > 25 and bmi < 30:
43+
print('Your BMI is', bmi,'which means you are overweight')
44+
45+
elif bmi > 30:
46+
print('Your BMI is', bmi,'which means you are obese.')
47+
48+
else:
49+
print('There is an error with your input')
50+
print('Please check you have entered whole numbers\n'
51+
'and decimals were asked.')
52+
53+
input('\n\nPlease press enter to exit.')

0 commit comments

Comments
 (0)