Slice with step
Input
SliceableList([0, 1, 2, 3, 4, 5])[::2]
Output
[0, 2, 4]
A step of 2 selects every second item starting at index 0.
Full lesson preview
Extend indexing to accept slice objects so your sequence supports ranges, steps, and omitted bounds.
Problem statement
Task
Examples
Input
SliceableList([0, 1, 2, 3, 4, 5])[::2]
Output
[0, 2, 4]
A step of 2 selects every second item starting at index 0.
Input format
Output format
Constraints
Samples
Input
SliceableList(["a", "b", "c", "d"])[1:3]
Output
['b', 'c']
Slicing from 1 (inclusive) to 3 (exclusive) returns ['b', 'c'].