why did the value of a change?

the question has been answered in the comments by @user2357112 supports Monica, and by @Wups

answer

import copy

def transition(x):
    y = copy.deepcopy(x)
    y[1][1] = y[2][1]
    y[2][1] = 0 
    return y

a = [[12, 11, 7, 13], [6, 0, 8, 3], [9, 4, 10, 2], [5, 14, 15, 1]]

print(a, ":before function")

b = transition(a)

print(a, ":after function")

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top