Understanding the copy() function in Python

Creating duplicate lists with different reference ids

Joe Cardillo
Level Up Coding
Published in
2 min readJan 4, 2021

--

The copy() function lets you make a duplicate copy of a list, while giving it a different reference id.

To help illustrate this, let’s first create a list of 1s and 0s and set it equal to a variable called binary:

>>> binary = [1, 1, 0, 1, 1, 0, 1, 0…

--

--