Mutation Mystery Def Deep Copy Lst Returns A New List That Is A Deep Copy Of Ls

deep_copy

#Mutation Mysterydef deep_copy ( lst) :""Returns a new list that is a deep copy of lst.>>> x = [[0, ‘a’], [1, ‘b’], [2, ‘c’ ] ]>>> y = deep_copy (x)>>> y[0] [1] = ‘z’>>> y[[O, ‘z’], [1, ‘b’], [2, ‘c’]]>>> X[[o, ‘a’], [1, ‘b’], [2, ‘c’]]>>> x = [[0, ‘a’], [1, ‘b’], [2, ‘c’] ]>>> z = deep_copy (x)>>> z [0] [1] = ‘z’>>> Z[[O, ‘z’], [1, ‘b’], [2, ‘c’]]>>> X#x should not change[[O, ‘a’], [1, ‘b’], [2, ‘c’]]IIIIII"xx* YOUR CODE HERE ***"

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *