slice and splice on train #1: which copies onto a new train, which changes train #1 itself and moves the rest, and what does each hand back? Every read and…
The key idea
slice copies, splice changes in place: similar names, opposite jobs
Try it in this playground
Copy with slice Run slice(1, 3): a new train, wagon 3 stays out, #1 is whole.
Take off with splice Run splice(1, 2): what came off is #2, #1 changes and is still #1.
Insert without taking off splice(2, 0, 'es'): what comes back is [], but #1 grows.
Count from the back Use a negative start: watch the numbers from the back under the wagons.