mercredi 1 décembre 2021

Bmi calculator if statements do not work in python

I am stuck writing a program to calculate bmi and categorizing them.

individuals = list()
for i in range(6):
    user = str(input("Please enter the names of the 6 users who want to calculate their BMI: "))
    individuals.append(user)
BMIs = []
for user in individuals:
    print("Calculating for", user)
    height = int(input(user + ", in inches, how tall are you? "))
    weight = int(input(user + ", in pounds, how much do you weight? "))
    BMIs.append(user  + ", your BMI is: " + str(weight * 703/height**2))

for BMI in BMIs:
    print(BMI)
    
if  int(BMI)< 16:
   print( user + "BMI is:" + str(bmi) + "and you are:severely underweight")

elif int(BMI)>= 16 and bmi < 18.5:
   print( user + "BMI is:" + str(bmi) + "and you are:severely underweight")

elif int(BMI) >= 18.5 and bmi < 25:
   print( user + "BMI is:" + str(bmi) + "and you are:severely Healthy")

elif int(BMI)>= 25 and bmi < 30:
   print( user + "BMI is:" + str(bmi) + "and you are:severely overweight")

elif int(BMI) >=30:
   print( user +" " + "BMI is:" + str(bmi) + "and you are:severely overweight")

the if statements dont work and i cant figure how to categorize those who are overweight, healthy

Aucun commentaire:

Enregistrer un commentaire