reverse , reversed

ash3767·2020년 5월 26일
0

reverse()

num_list = [1,2,3,4]
num_list.reverse()
print(num_list)
# [4,3,2,1]

reversed()

seqList = [1, 2, 4, 3, 5]
print(list(reversed(seqList)))
 
# [5, 3, 4, 2, 1]
 
 
array=[0, 10, 20, 40]
for i in reversed(array):
    print(i)
    
'''
40
20
10
0
'''
profile
Backend Development

0개의 댓글