unable to add ia single element into a 2d python list -


hi i'm afraid basic question can't work - trying change single entry in 2d array adding 3 - driving me nutty - please tell me doing wrong (see following)

list1 = [["0"]*5]*3 print (list1)  list1[0][0] = "r" print (list1) 

this giving me output follows "r" repeated in positon 0 3 times

[['r', '0', '0', '0', '0'], ['r', '0', '0', '0', '0'], ['r', '0', '0', '0', '0']] 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -