Skip to main content

Practice · 4 of 4

Head and Tail

CHALLENGE
Difficulty: intermediate+25 XP

Implement head_tail(items) that returns a tuple (first, rest) where rest is a list of everything after the first item. Use unpacking, not slicing, and return (None, []) for an empty input.

Back to lesson: Practice: Comprehension Drills