1>>> the_list = [1,2,3]
2>>> reversed_list = the_list.reverse()
3>>> list(reversed_list)
4[3,2,1]
5
6OR
7
8>>> the_list = [1,2,3]
9>>> the_list[::-1]
10[3,2,1]
1When you call range() with three arguments, you can choose not only
2where the series of numbers will start and stop but also how big the
3difference will be between one number and the next.
4
5range(start, stop, step)
6
7If your 'step' is negative and 'start' is bigger than 'stop', then
8you move through a series of decreasing numbers.
9
10for i in range(10,0,-1):
11 print(i, end=' ')
12# Output: 10 9 8 7 6 5 4 3 2 1
1my_list = [1, 2, 3]
2my_list.reverse() # my_list is modified
3print(my_list) # '[3, 2, 1]'
4my_revert = my_list[::-1] # my_list stays [3, 2, 1]
5print(my_revert) # '[1, 2, 3]'
6# Item by item reverse with range(<start>, <end>, <step>)
7for i in range(len(my_list), 0, -1): # my_list is [3, 2, 1]
8 print(my_list[i-1]) # '1' '2' '3'
9for i in reversed(range(len(my_list))):
10 print(my_list[i]) # '1' '2' '3'