def head(l) : return l[0] def tail(l) : return l[1:] class Node : def __init__ (self, cargo = None, next = None) : self.cargo = cargo self.next = next def __str__ (self) : return str(self.cargo) def print_ll(linked_list) : print(linked_list) if linked_list.next <> None : print_ll(linked_list.next) node1 = Node("test") node2 = Node(3) node2.next = node1 node3 = Node([1,2,3], node2) node0 = Node("at the back") node1.next = node0 def nth_element(linked_list, num) : if num==0 : return linked_list else : return nth_element(linked_list.next, num-1)