Inflearn brand logo image

Inflearn Community Q&A

dagon8280122's profile image
dagon8280122

asked

Getting Started with Programming: Introduction to Python (Inflearn Original)

while(3-1) : It's a little different from the for syntax

while 문 질문

Written on

·

204

0

a  = ['foo', 'bar', 'baz']

while True:

    if not a:

        break

    print(a.pop())

여기서 break에 어떻게 걸리는건가요? while True로 무한반복을 돌리고 a가 아니면 멈추고 print(a.pop())을 출력하는거 잖아요 근데 어떻게 break 문에 걸리나요? if not a 라는게 a = []일떄 break 가 걸리는건데요

python

Answer 1

1

문자열, 리스트, 튜플, 딕셔너리 등의 값이 비어 있으면(" ", [ ], ( ), { }) 거짓을 의미합니다. 

https://wikidocs.net/17

dagon8280122's profile image
dagon8280122

asked

Ask a question