Advertisement
user_137

Untitled

Feb 25th, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. def copy(L1, L2):
  2.     """Assumes L1, L2 are lists
  3.        mutates L2 to be a copy of L1"""
  4.     while len(L2) > 0: #remove all elements from L2
  5.         L2.pop() #remove first element of L2
  6.     for e in L1: #append L1’s elements to initially empty L2
  7.         L2.append(e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement