D. concat(L1, L2): returns a mylist that is a concatenation of L1 and L2.

From EECS 182
D. concat(L1, L2): returns a mylist that is a concatenation of L1 and L2.
Jump to: navigation, search
  1. return the concatenation of two lists. Best to solve recursively. Base case: L2 is empty.

def concat(L1, L2):

   if (L2.isempty()):
       return L1
   else:
       return concat(L1, L2.pop()).append(L2.last())
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
EECS @ UM
Tools