Skip to main content

Practice ยท 4 of 4

Head and Tail

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.

Difficulty: intermediate

Back to lesson: Practice: Comprehension Drills