Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 22514

Can't change single element in 2d list [duplicate]

$
0
0

I want to change only one element in the 2d list. I can change an element in list1 using list1[0][2] = "x" but when i do the same for list2 more than one element is changed.

list1 = []for i in range(0,5):    list1.append(['O']*5)list2 = [['o','o','o','o','o']]*5

Viewing all articles
Browse latest Browse all 22514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>