I want to create a list of strings. The Strings should all be the same except for some elements, where they should be different. Doing this I came across a strange behaviour:
x = ['spam', 'spam', 'spam', 'spam', 'spam']
x[1] = 'buzz'
x[2] = 'buzz'
x
Out[35]: ['spam', 'buzz', 'buzz', 'spam', 'spam']
But on the other hand:
y = ['spam'] * 5
y[1:3] = ['buzz']
y
Out[36]: ['spam', 'buzz', 'spam', 'spam']
Can someone pleas tell me what I am doing wrong? Thank you very much for your help!