Python List Slicing with [start:end] Explained

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

  • Lesson 2 of 5
  • PRO
  • Ages 10+
  • 3 hands-on levels
See what PRO unlocksA one-time $49.99 purchase. Topics 1–3 are free.

The dragon explains

Slicing — taking a piece

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

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

    example.pyPython 3
    hoard = ["gold", "gems", "sword", "shield"]print(hoard[0:2])
    Output['gold', 'gems']
  3. The dragon: Same exclusive-endpoint rule as range() — the end number is where it STOPS, not the last item included.

    example.pyPython 3
    hoard = ["gold", "gems", "sword", "shield"]print(hoard[0:2])
  4. The dragon: Here's the important part: slicing NEVER changes the original list. It hands you a brand new one.

    example.pyPython 3
    hoard = ["gold", "gems", "sword", "shield"]print(hoard[0:2])print(hoard)
    Output['gold', 'gems'] ['gold', 'gems', 'sword', 'shield']
  5. The dragon: hoard still has all 4 items after slicing. Nothing was removed — the slice is a completely separate, new list.

Quick check

Check your understanding

Say your answer out loud before reading the marked one. Every wrong option is a mistake real beginners make.

  1. Question 1 of 1

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

    question.pyPython 3
    hoard = ["gold", "gems", "sword", "shield"]print(hoard[0:2])
    • Still 4 — hoard is completely unchangedCorrect
    • 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.

In the game

What you'll practice

Three levels in the game: one guided first try with the shape of the answer already there, then two to solve on your own.

  1. 1

    GuidedYour first try

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

  2. +2

    PracticeTwo more, on your own

This lesson is part of PRO.

PRO is a one-time $49.99 purchase, no subscription, and unlocks this whole topic along with everything else. Topics 1–3 are free, start to finish.

Unlock this lesson with PRO

Stuck three times? The game offers the answer — unasked.