Python Slicing [start:stop:step] Playground

seq[a:b:c] with negative indices & step. Drag, see which elements get picked. Why [::-1] reverses order. An interactive Python Slicing [start:stop:step]…

Why it matters

str, list, tuple, bytes and even range follow exactly the same rules. Misreading the exclusive stop or a negative step raises no error; it just quietly gives one too few or nothing. Bugs like that slip past tests that never check the ends.

The key idea

A slice is range(start, stop, step) with its bounds tidied first

Common mistakes

Try it in this playground