Reverse a List using For Loop

To reverse a list of elements in Python, iterate over the list from the end to start, and append each of the iterated element in a new list.


In the following python program, we initialize a python list with some string values, and reverse the list using a for loop.

#initialize list
myList = ['apple', 'banana', 'cherry', 'mango']

#store reversed list in this
reversedList = []

#reverse list using for loop
for i in range(len(myList)) :
    reversedList.append(myList[len(myList) - i - 1])

#print lists
print(f'Original List : {myList}')
print(f'Reversed List : {reversedList}')


Original List : ['apple', 'banana', 'cherry', 'mango']
Reversed List : ['mango', 'cherry', 'banana', 'apple']


In this Python Tutorial, we learned how to reverse a list using for loop.