본문 바로가기
Python/DataType&Structure

제어문

by youngflowey 2019. 11. 26.

if 문

area = ["seoul","pusan","jeju"]
if "suwon" in area:
    print("수원이 있어요!")
elif "seoul" in area:     # 그렇지 않으면 혹시 이거니? else+if    
    print("서울이 있어요!")
else:
    print("기타등등")
    
if "suwon" in area:
    pass  # 하는일이 아무것도 없을때 사용

 

for 문

for k in range(10):
    print("k값은 : {}".format(k))

 

while 문

test=1
while test < 10:
    print("test값은 {}".format(test))
    test += 1   # test값을 누적
                # test = test +1

 

 

while True:
    print("무한무한")
    
# 무한루프 중지버튼으로 정지시켜 

'Python > DataType&Structure' 카테고리의 다른 글

Python Built - in Type(내장 데이터 타입)  (0) 2019.11.26
set type  (0) 2019.11.26
bool type  (0) 2019.11.26
Mapping Type - dic(dictionary)  (0) 2019.11.26
Sequence Type - range  (0) 2019.11.26

댓글