# BMI calculator in #python

Following a conversation with a student today, here is my version of a simple Python 3 script for calculating your body mass index index.

print("BMI Calculator")

while True:
mass = float(input("\n\nEnter mass (kg): "))
height = float(input("Enter height (m): "))
bmi = mass / (height**2)
underweight = 18.5 * (height**2)
normal = 25 * (height**2)
borderline = 30 * (height**2)

print("Your bmi is : ", "%.1f" % bmi)

if (bmi <= 18.5):
print("'Underweight.'")
print("To be 'normal' weight, your mass would need to be : ", "%.1f" % underweight, "-", "%.1f" % normal, "kg" )
print("You are advised to gain ", "%.1f" % (mass - underweight), "kg")
elif (bmi < 25):
print("Normal weight.")
elif (bmi <30):
print("Borderline high.")
print("To be 'normal' weight, your mass would need to be : ", "%.1f" % underweight, "-", "%.1f" % normal, "kg" )
print("You are advised to lose ", "%.1f" % (mass - normal), "kg")
else:
print("High")
print("To be 'normal' weight, your mass would to be : ", "%.1f" % underweight, "-", "%.1f" % normal, "kg" )
print("You are advised to lose ", "%.1f" % (mass - normal), "kg")
print("To be 'borderline high', your mass would need to be : ", "%.1f" % borderline, "-", "%.1f" % normal, "kg" )
print("You are advised to lose ", "%.1f" % (mass - borderline), "kg")