arr = [1, 2, 3, 4, 5]
arr[1:3] = 'ABCD'
arr
[1, 'A', 'B', 'C', 'D', 4, 5]
Exactually, this code is useless. I don't think anyone uses python lists like this. But i wanna know about the result just because of curiosity.
I can know something intuitively seeing result.
old
arr[1:3]
(2, 3
) is gone and replaced by string'ABCD'
sequentially.
But just fact about results, I can't understand how it works.
Can I get some hint or docs for understand this result?