How can one reverse the order of a list in Python without using a loop?

list, list-comprehension, python

Solution

a = ['a','b','c']

you can try

b = a[::-1]

It will reverse the list without using loop.

You can use the same trick on any sequence/container/iterable to get item reversed.

Problem

How can one reverse the order of a list in Python without using a loop? There are no other constraints on the solution space.

Original source

Related problems