BMI
Take in the
Mass Height
Print out which bmi class the user is in
def BMI(mass, height):
return mass/height**2
def category(bmi):
descrip = ['Severe Thiness', 'Moderate Thinness', 'Mild Thinness',
'Normal', 'Overweight', 'Obese Class I',
'Obese Class II', 'Obese Class III']
if bmi < 16:
idx = 0
elif bmi < 17:
idx = 1
elif bmi < 18.5:
idx = 2
elif bmi < 25:
idx = 3
elif bmi < 30:
idx = 4
elif bmi < 35:
idx = 5
elif bmi < 40:
idx = 6
else:
idx = 7
return descrip[idx]
def main():
mass = float(input('Input your mass (in kg): '))
height = float(input('Input your height (in m): '))
bmi = BMI(mass, height)
descrip = category(bmi)
print(f'Your BMI is {bmi:.1f} and you are {descrip} according to the WHO')
if __name__ == '__main__':
main()
Comments
Leave a comment