Here is the 1st code.
lst=11*[[]]
print(lst)
word="Mia"
value=0
for i in word:
value+=ord(i)
n=value%11 #Loaction number
lst[4]+=[word]
print(lst)
This output will be this [['Mia'], ['Mia'], ['Mia'], ['Mia'], ['Mia'], ['Mia'], ['Mia'], ['Mia'], ['Mia'], ['Mia'], ['Mia']]
The 2nd one.
lst=11*[[]]
print(lst)
word="Mia"
value=0
for i in word:
value+=ord(i)
n=value%11 #Loaction number
lst[4]=lst[4]+[word]
print(lst)
This will produce this result. [[], [], [], [], ['Mia'], [], [], [], [], [], []]
What's the difference between lst[4]=lst[4]+[word]
and lst[4]+=[word]
?
I originally assume the abbreviation of lst[4]=lst[4]+[word]
is lst[4]+=[word]
.
But they're apparently not.