+ 1
Python | Lists | Explain Output
5 odpowiedzi
+ 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.
+ 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.
0
Code updated and saved
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.