Files
curriculum/1.solar-system/3.strings/02.the-slicer/index.md

940 B

type, title, xp, duration, difficulty
type title xp duration difficulty
challenge The Slicer 50 25 2

The Slicer

[INCOMING — Mission Control, Earth]

Cadet, slicing grabs a chunk of a string instead of one character. The syntax is s[start:end]start is included, end is not.

s = "ANDROMEDA"
s[0:3]   # "AND"
s[3:7]   # "ROME"
s[-2:]   # "DA"

Telemetry packets always arrive in this exact format (length 30):

TIMESTAMP=YYYY-MM-DDTHH:MM:SSZ

Implement extract(header) that returns a tuple (date, time):

  • date = YYYY-MM-DD (10 chars)
  • time = HH:MM:SS (8 chars)

Figure out which slice positions hold each piece.

[END TRANSMISSION]

Your Task

In starter/starter.py, return (date, time) extracted with slicing.

Objectives

  • extract("TIMESTAMP=2026-05-04T14:32:01Z")("2026-05-04", "14:32:01")
  • Works for any header in the same fixed format