728x90
반응형
# break
IntCollection=[0,1,2,3,4,5,6,7]
for x in IntCollection:
if(x==3):
break
else:
print(x)
>> 0
>> 1
>> 2
# continue
IntCollection=[0,1,2,3,4,5,6,7]
for x in IntCollection:
if(x==3):
continue
else:
print(x)
>> 0
>> 1
>> 2
>> 4
>> 5
>> 6
>> 7
728x90
반응형
'Python > python 기초' 카테고리의 다른 글
list와 dictionary 차이점 (0) | 2021.09.25 |
---|---|
요소 추가 append(), extend(), insert() (0) | 2021.05.13 |
range로 반복문 활용하기 (0) | 2021.05.10 |
경계 검사 (bounds checking) (0) | 2021.05.09 |
(메소드) rjust, zfill, split, startswith, endswith, replace, copy (0) | 2021.05.09 |