Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
BMI calculator.py
This is a project for calculating bmi of person
  • Loading branch information
AnshMeshram authored Oct 16, 2023
commit 92c1a31b9f9bb08fdbac238481792ef694e5a7e3
49 changes: 49 additions & 0 deletions BMI calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,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.')