Sobes.tech
Junior — Senior

What happens when a list is multiplied and then its element is changed?

livecode

Task condition

What will be the output of the program and why? Consider the code where a list is created by multiplication and then one of its elements is modified.

matrix = [[]] * 3
matrix[1].append(1)
print(matrix)

Explain what the console will print and what features of working with multiplied lists affect the result.