how to do a for loop backwards in python code example
Example 1: python for loop backwards
for i in range(len(item)-1, -1, -1):
print(item[i])
Example 2: reverse for loop in python
for i in range(10, -6, -2):
print(i)
for i in range(len(item)-1, -1, -1):
print(item[i])
for i in range(10, -6, -2):
print(i)