0

I have a list like named as modified and can be seen below;

modified = [["a"]*3]*3

If I want to change the value of first index in first element with "1", I use the codeblock below;

modified[0][0] = int(1)

However, the result is shown as [[1, 'a', 'a'], [1, 'a', 'a'], [1, 'a', 'a']].

I was expecting the result as [[1, 'a', 'a'], ['a', 'a', 'a'], ['a', 'a', 'a']]. How can I solve this issue?

murcielago
  • 11
  • 4

0 Answers0