CurriculumPython Lists, Indexing and Slicing for KidsSlicing — taking a piece

Python List Slicing with [start:end] Explained

hoard[start:end] gets a range of items — and never changes the original list.

Lesson 2 of 5PROAges 10+
See what PRO unlocks →

Slicing — taking a piece

You can grab more than one item at once with a SLICE — a start index and an end index.

hoard[0:2] means 'start at index 0, stop before index 2' — items 0 and 1, exactly two of them.

hoard = ["gold", "gems", "sword", "shield"]
print(hoard[0:2])

Output

['gold', 'gems']

Same exclusive-endpoint rule as range() — the end number is where it STOPS, not the last item included.

hoard = ["gold", "gems", "sword", "shield"]
print(hoard[0:2])

Here's the important part: slicing NEVER changes the original list. It hands you a brand new one.

hoard = ["gold", "gems", "sword", "shield"]
print(hoard[0:2])
print(hoard)

Output

['gold', 'gems']
['gold', 'gems', 'sword', 'shield']

hoard still has all 4 items after slicing. Nothing was removed — the slice is a completely separate, new list.

Check your understanding

hoard has 4 items. After you run print(hoard[0:2]), how many items are left in hoard itself?

hoard = ["gold", "gems", "sword", "shield"]
print(hoard[0:2])
  • Still 4 — hoard is completely unchanged
  • 2 — the sliced items were removed from hoard
  • 0 — hoard becomes the slice

Why: hoard still has all 4 items — slicing creates a brand new list and leaves the original completely untouched. This is true for lists, and it's true for strings too, if you ever slice text the same way.

What you'll practice

hoard = ["gold", "gems", "sword", "shield"]. Print just the FIRST TWO items, in order, as a slice.

Unlock this lesson with PRO →

More from this topic

Slicing — taking a piece is one lesson inside Python Lists, Indexing and Slicing for Kids — see the full lesson order and what the whole topic covers.

View the full topic →