Iterating lists in Python for Dummies

Forward and backward iterations in Python

Imagine your in a situation that needs to go through the elements of a list in backward order. To achieve this we need to read the last element first and then the last but one and so on till the element at index 0. Various python programming features can be used to achieve this.

Example

list = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']
for i in range( 0, len(list)) :
print(list[i])

Output

Mon
Tue
Wed
Thu
Fri