Python Programming - Loops - Discussion

Discussion Forum : Loops - General Questions (Q.No. 22)
22.
Which of the following is a correct way to iterate over a list in reverse order?
for item in reversed(my_list):
for item in my_list.reverse():
for item in reverse(my_list):
for item in my_list[::-1]:
Answer: Option
Explanation:
The reversed() function is used to iterate over a list in reverse order in Python.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.