Python/Python__works

list 거꾸로 출력하기

말하는감자 2019. 7. 8. 16:04
a = [1, 2, 3, 4, 5]

#solution 1
a.reverse()
for i in a:
    print(i)

#solution 2
for i in reversed(a):
    print(i)

'Python > Python__works' 카테고리의 다른 글

lambda  (0) 2019.07.14
python lambda  (0) 2019.07.14
conda 가상환경  (0) 2019.06.13
requests, get cookies  (0) 2019.06.13
collections  (0) 2019.06.12