The Python assignment operator, function definitions, and
0. As you've discovered, the = operator in Python doesn't make a copy of an object like it does in C++ for example. If you want to make a copy to store in another variable you have to be explicit about it. board[1] = deck1[:] # the slicing operator copies a subset or the whole list. A more general method is to use the copy module.
IMAGES
VIDEO
COMMENTS
0. As you've discovered, the = operator in Python doesn't make a copy of an object like it does in C++ for example. If you want to make a copy to store in another variable you have to be explicit about it. board[1] = deck1[:] # the slicing operator copies a subset or the whole list. A more general method is to use the copy module.