1# 1.
2for i in reversed(range(3)): # output: 0
3 print(i) # 1
4 # 2
5# works with arrays as well , reversed(arr)
6
7# 2.
8# another alternative is
9arr = [1,2,3]
10# note: arr[start : end : step]
11for i in arr[::-1]: # output: 0
12 print(i) # 1
13 # 2
14
15# 3.
16# last alternative i don't recommened!
17# note: range(start, end, step)
18for i in range(len(arr) - 1, -1 , -1): # output: 0
19 print(i) # 1
20 # 2
21# read more on range() to understand even better how it works has the same rules as the arrays
1# for i in range(start, end, step)
2for i in range(5, 0, -1):
3 print(i)
45
54
63
72
81
9
10