반복문 : 프로그램이 순차적으로 실행되다가 어떤 조건 하에서 일련의 코드들을 반복적으로 실행되도록 하는 것
list에 있는 data를 하나씩 가져오는 것
The for statement is used to iterate over the elements of a sequence (such as a string, tuple or list) or other iterable object:
for_stmt ::= "for" target_list "in" expression_list ":" suite
["else" ":" suite]
n번 반복하도록 하는 것
for i in range(10):
print(i)
i = 5 # this will not affect the for-loop
# because i will be overwritten with the next
# index in the range
#list
print(1)
for value in ['a','b','c']:
print(value)
print(2)
print('---range---')
#rage
for value in range(10):
print(value)
#python3 file list in directory
'Python' 카테고리의 다른 글
2. 자료형과 문자열 (0) | 2022.03.04 |
---|---|
1. 파이썬 용어 (0) | 2022.03.03 |
- 문법 - List (0) | 2022.02.28 |
- 문법 (0) | 2022.02.28 |
- 문법, 데이터타입, 숫자 (0) | 2022.02.28 |