Python list.insert(i,x) weird behavior?

When I used list.insert(i,x) , I assumed that it will replace the current value x at position i with a new value of x at position i. When I test the list, I got these weird results.

1. 5 elements built into list L
[0, 1, 2, 3, 4, 5]

2. Going back and trying to override number 4, I get.
[0, 1, 2, 3, 4, 4, 5]

List grows on insertion of previous value. Wat?

Leave a Reply