Append the first element of the list to a reversed sublist:
mylist = [1, 2, 3, 4, 5]
backwards = lambda l: (backwards (l[1:]) + l[:1] if l else [])
print backwards (mylist)
More Related Contents:
- Python recursion with list returns None [duplicate]
- Basics of recursion in Python
- How to do a recursive sub-folder search and return files in a list?
- How to find common elements in list of lists?
- Confusing […] List in Python: What is it?
- Generate all possible lists of length N that sum to S in Python
- Flattening a list recursively [duplicate]
- Python recursive function to display all subsets of given set
- Given a list of elements in lexicographical order (i.e. [‘a’, ‘b’, ‘c’, ‘d’]), find the nth permutation – Average time to solve?
- How do you split a list into evenly sized chunks?
- How do I get the last element of a list?
- Fastest way to check if a value exists in a list
- Modifying list while iterating [duplicate]
- Python find elements in one list that are not in the other [duplicate]
- Find the item with maximum occurrences in a list [duplicate]
- Which is faster and why? Set or List?
- Get a list of values from a list of dictionaries?
- compare two lists in python and return indices of matched values
- Joining elements in a list without the join command
- How do I declare an array in Python?
- Python IndexError: list index out of range
- What all things happens inside pygame when I press a key? When to use pygame.event==KEYDOWN
- List as a member of a python class, why is its contents being shared across all instances of the class?
- Sort a list with a custom order in Python
- Concatenation of many lists in Python [duplicate]
- Python List Indexing Efficiency
- Why Python raises RecursionError before it exceeds the real recursion limit?
- Mapping dictionary value to list
- How to change variables fed into a for loop in list form
- list extend() to index, inserting list elements not only to the end