In a throwback to CT days, you have to write one of the basic list functions.
Write a function named rest that accepts a list L as argument. If the list is
non-empty and has size n, it should return the last n - 1 elements as a list.
If the list is empty, it should return None.
Note that if L has just one element, rest(L) should return the empty list.
You do not have to accept input from the user or print anything to the console. You just have to write the function definition.
Example
rest([1, 2, 3]) -> [2, 3]
rest([7]) -> []
rest([]) -> None
Implement this function:
def rest(L):
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: L.
Input
[]
Output
None