[파이썬] if 사용할때 들여쓰기질문 (코딩처음해봄)

조회수 813회

BMI지수로 과체중 저체중 적정체중인지 판단하려하는데

if BMI<18.5:
    print("Your BMI indicates that you are underweight.")
    if BMI>25:
        print("Your BMI indicates that you are overweight.")
else:
    print("Your BMI indicates that you are optimal weight.")

이렇게 써보니까 BMI가 25가 넘어갈때도 optimal weight라고 뜨더라고요
어떻게 고쳐야 제가 원하는대로 나올수있을까요?

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)