# L-16 MCS 275 Wed 20 Feb 2008 : recrevlist.py

# Describe a recursive algorithm to revert
# the order of the elements in a list.
# The elements of the input list will appear
# in reverse order in the output list
# returned by the Python function.

def revlist(L):
   """
   Returns the list L with the elements
   in reverse order.
   """
   if len(L) < 2:
      return L
   else:
      return revlist(L[1:len(L)]) + [L[0]]

def main():
   """
   Prompts the user for a list and
   reverts the order of the elements.
   """
   L = input('Give a list : ')
   K = revlist(L)
   print K

main()
