파이썬 반복문 유형

조회 1,344 · 댓글 0
1103동103호작성자2019년 7월 26일
1. range 형


for i in range(1, 11):

print(i)



2. list 형


list1 = ["a", "b", "c", "d"]

for i in list1:
print(i)



3. tuple 형


tuple1 = ['a', 'b', 'c', 'd']

for t in tuple1:
print(t)



4. 문자열 형


str1 = "Hello World"

for s in str1:
print(s)

로그인 후 답글을 남길 수 있습니다.