Reversed

Learn how to reverse sequences with the help of the "reverse" function.

We'll cover the following...

reversed function

reversed is a useful function. It returns an iterator that reverses the order of the elements in the original sequence. For example:

Press + to interact
a = [2, 4, 6, 8]
r = reversed(a)
print(list(r))

Here, r is an iterator that accesses the elements ...

Access this course and 1400+ top-rated courses and projects.