0

I want to append one word to the 3rd list inside the nested lists but the word is getting appended to all other lists inside the nested lists

Here is the python code:

>>> s=[[]*6]*6

>>> s
[[], [], [], [], [], []]

>>> s[2].append("good")

>>> s
[['good'], ['good'], ['good'], ['good'], ['good'], ['good']]

What changes should I make to resolve this issue

OneCricketeer
  • 151,199
  • 17
  • 111
  • 216

0 Answers0