the copy module' copy(and deepcopy(functions although passing around references is often the handiest way to deal with lists and dictionariesif the function modifies the list or dictionary that is passedyou may not want these changes in the original list or dictionary value for thispython provides module named copy that provides both the copy(and deepcopy(functions the first of thesecopy copy()can be used to make duplicate copy of mutable value like list or dictionarynot just copy of reference enter the following into the interactive shellimport copy spam [' '' '' '' 'id(spam cheese copy copy(spamid(cheesecheese is different list with different identity cheese[ spam [' '' '' '' 'cheese [' ' ' '' 'now the spam and cheese variables refer to separate listswhich is why only the list in cheese is modified when you assign at index as you can see in figure - the reference id numbers are no longer the same for both variables because the variables refer to independent lists figure - cheese copy copy(spamcreates second list that can be modified independently of the first if the list you need to copy contains liststhen use the copy deepcopy(function instead of copy copy(the deepcopy(function will copy these inner lists as well lists