In [1]:
#defining mylist
mylist = ['a','b','c','d','e']
#defining the reversedlist using the built-in reversed function
reversedlist = [i for i in reversed(mylist)]
#print the reversedlist
reversedlist
Out[1]:
Line by line explanations of how things work in Python
#defining mylist
mylist = ['a','b','c','d','e']
#defining the reversedlist using the built-in reversed function
reversedlist = [i for i in reversed(mylist)]
#print the reversedlist
reversedlist
['e', 'd', 'c', 'b', 'a']