def BMI_calculator(inches, weight):
""" This function takes a persons height in feet and inches and their
weight in pounds and calculates their BMI"""
# Now we can just convert and calculate BMI
metric_height= inches* .025
metric_weight= weight* .45
BMI = int(metric_weight/(metric_height)**2)
print BMI
return BMI
def BMI_user_calculator():
""" This function will ask the user their body information and calulate
the BMI with that info"""
# First we need to gather information from the user to put into the BMI calculator
user_weight = int(raw_input('Enter your weight in pounds: '))
user_height = int(raw_input('Enter your height in inches: '))
print "Youre BMI is",
BMI_calculator(user_height, user_weight)
If BMI < 18.5:
print "You're BMI is below the healthy range for your age"
elif BMI > 24.9:
print "You're BMI is above the healthy range for your age"
else:
print "You are in the healthy BMI range!"
이 말했다 내가 지금까지 가지고있는 코드되고있는 이유 이해하지 않지만, 실행 내가 BMI
말을 내 if
문 내에서 구문 오류가 발생하면 정의되지 않았습니다. BMI
이 첫 번째 함수에서 반환되었으므로 실제로 어떤 일이 발생하는지 이해하지 못합니다.내가 내가 내가 여기에 구문 오류
당신의'BMI' 변수는 BMI_Calculator''내에 존재 :
코드는 다음과 같이 뭔가를 읽어야한다. user_calculator에서 리턴 값을 포착하지 않으므로 거기에있는'BMI'는 정의되지 않은 변수입니다. 그리고 언어학적인 측면에서, "너"-> "너는". "당신은 bmi입니다"는 말이되지 않습니다. –