랭귀지/python

python while

유키공 2018. 9. 27. 14:20
while 반복문으로 리스트의 요소를 출력.
a = [1, 2, 3, 4, 5]
i = 0
while i < len(a):
    print(a[i])
    i += 1
결과 : 1
2
3
4
5