본문 바로가기

SweetPotato1024/Python.PyCharm

if-else : 실행순서

반응형

attend = int(input("출석 점수를 입력하세요:"))

if not 0 <= attend <= 10:
    print("다시 입력하세요.")
else:

    if attend < 8:

        print("불합격")

 

-> else가 없으면, 입력값이 8보다 적은 수여도 불합격이 출력되지 않는다. 

반응형

'SweetPotato1024 > Python.PyCharm' 카테고리의 다른 글

while : if continue ≠ while  (0) 2021.10.12
Python 용어 정리  (0) 2020.12.03
Python.exBAKE  (0) 2020.12.03