Instructions
** BMI값이 18.5 아래면, 저체중이다
** BMI값이 18.5 넘고, 25 아래면, 정상체중
** BMI값이 25 넘고 35 아래면, 비만
** BMI값이 35 넘어가면 고도비만
BMI는 사람 몸무게를 키의 제곱으로 나눠서 계산함
BMI값을 가장 가까운 정수형으로 나타내시오 (뜻: 반올림해라;)
weight = 85
height = 1.75
85 ÷ (1.75 x 1.75) = 27.755102040816325
Your BMI is 28, you are slightly overweight.
"Your BMI is 18, you are underweight."
"Your BMI is 22, you have a normal weight."
"Your BMI is 28, you are slightly overweight."
"Your BMI is 33, you are obese."
"Your BMI is 40, you are clinically obese."
⇒ 변수 bmi 데이터형을 명시 안해줬네..
Int형으로 명시해주면 코드 실행 잘돼는데
bmi 값은 근사한 정수형으로 나타내라는건 반올림하란 얘기다. int() 형변환 하라는 뜻이 아님.
# 🚨 Don't change the code below 👇
height = float(input("enter your height in m: "))
weight = float(input("enter your weight in kg: "))
# 🚨 Don't change the code above 👆
#Write your code below this line 👇
bmi = weight / height ** 2
if bmi <= 18.5 :
print(f"your BMI is {bmi}, you are underweight.")
elif bmi > 18.5 :
if bmi <= 25 :
print(f"your BMI is {bmi}, they have a normal weight.")
elif bmi > 25 :
if bmi <= 30 :
print(f"your BMI is {bmi}, you are slightly overwight.")
elif bmi > 30 :
if bmi <= 35 :
print(f"your BMI is {bmi}, you are obese.")
else :
print(f"your BMI is {bmi}, you are clinically obese.")
# 🚨 Don't change the code below 👇
height = float(input("enter your height in m: "))
weight = float(input("enter your weight in kg: "))
# 🚨 Don't change the code above 👆
#Write your code below this line 👇
bmi = round(weight / height ** 2) # 반올림해서 소숫점 없는 정수형으로 나타내어진다
if bmi <= 18.5 :
print(f"your BMI is {bmi}, you are underweight.")
elif bmi > 18.5 :
if bmi <= 25 :
print(f"your BMI is {bmi}, they have a normal weight.")
elif bmi > 25 :
if bmi <= 30 :
print(f"your BMI is {bmi}, you are slightly overwight.")
elif bmi > 30 :
if bmi <= 35 :
print(f"your BMI is {bmi}, you are obese.")
else :
print(f"your BMI is {bmi}, you are clinically obese.")
bmi해석 메시지 출력 조건이 아래인데, 영어해석 실수를 했음
Under 18.5 they are underweight
Over 18.5 but below 25 they have a normal weight
Over 25 but below 30 they are slightly overweight
Over 30 but below 35 they are obese
Above 35 they are clinically obese.
Under 18.5 뜻: 18.5 미만
Over 18.5 뜻: 18.5 이상 (즉, 18.5를 포함해서 Up 이라는 것)
# 🚨 Don't change the code below 👇
height = float(input("enter your height in m: "))
weight = float(input("enter your weight in kg: "))
# 🚨 Don't change the code above 👆
#Write your code below this line 👇
bmi = round(weight / height ** 2)
if bmi < 18.5:
print(f"Your BMI is {bmi}, you are underweight.")
elif bmi < 25:
print(f"Your BMI is {bmi}, you have a normal weight.")
elif bmi < 30:
print(f"Your BMI is {bmi}, you are slightly overweight.")
elif bmi < 35:
print(f"Your BMI is {bmi}, you are obese.")
else:
print(f"Your BMI is {bmi}, you are clinically obese.")
#유데미 #유데미코리아 #스타트위드유데미 #스터디윗미