26th Jan 2020, 2:32 PM
Av23
5 Réponses
+ 4
https://code.sololearn.com/cSr8iDnTEeF7/?ref=app Hi.. I made a little experiment and printed all ids of lists of list2. 4 times the same id.
26th Jan 2020, 3:51 PM
Oma Falk
Oma Falk - avatar
+ 3
One time you multiply a list by 4, getting you 4 times the content in a list. Second time you multiply a list with a list in it. So again you get 4 times the content, in this case the list.
26th Jan 2020, 2:36 PM
HonFu
HonFu - avatar
0
Code updated and saved
26th Jan 2020, 2:42 PM
Av23
0
In Python, whenever you store something anywhere, in a variable, a list or anywhere else, you store the address of that object. So when you say 4 times [Letters] you get a list with 4 times the address to Letters. It's not 4 different lists, it's 4 times the very same list. So if you change it, they 'all' do.
26th Jan 2020, 2:52 PM
HonFu
HonFu - avatar