This is an advanced code for BMI calculator for one who are beginners in python.
You can calculate the following data from this code...
1. Your Body Mass Index (BMI)
2.Your fitness condition based on your weight.
3.The amount of weight you need to gain or loss..
#program goes like this
w=int(input('Enter your weight in kgs..'))
h=float(input('Enter your height in m..'))
def bmi(w,h):
bmi=w/(h**2)
print('Your BMI is ',bmi)
if bmi>18 and bmi <25:
print('You are healthy')
elif bmi<18:
print('You are underweight')
for x in range(0,100,1):
if (w+x)/h**2>18:
a=x
int (a)
break
print('You need ',a,' kg more weight to be healthy')
else:
print('You are overweight')
for x in range(0,100):
if (w-x)/h**2<=25:
a=x
break
print('You need to reduce ',a,' kg more weight to be healthy')
bmi(w,h)
Comments
Post a Comment