def print_list(x): if len(x) == 0: return first = x[0] rest = x[1:] print(first) #print first item print_list(rest) #print the rest of the list. def foo(x): if len(x) == 0: return first = x[0] rest = x[1:] foo(rest) #print the rest of the list. print(first) #print first item foo(["a", "b", "c", "d"]) foo(list(range(20)))