Thursday, 29 October 2026
PastThree rungs, one idea. Solving rung 1 counts. Climb as far as you can.
Words That Start The Same
strings + matching the start
Does it begin like that
Write a function called starts_with
Return True when word begins with the letters in start, checking them one position at a time. "cat" begins with "ca" but not with "at". An empty start matches every word, and a start longer than the word never matches.
Examples
| Input | Output |
|---|---|
| "cat", "ca" | True |
| "cat", "at" | False |
| "cat", "" | True |
| "ca", "cat" | False |
There are extra hidden tests, so make it work in general, not just for these.
Pick out the ones that do
Write a function called words_starting_with
Return a list of the words that begin with start, keeping the order they came in. An empty start keeps every word. If none of them match, and also when the list is empty, return an empty list.
Examples
| Input | Output |
|---|---|
| ["cat", "car", "dog"], "ca" | ["cat", "car"] |
| [], "ca" | [] |
| ["cat"], "d" | [] |
| ["cat", "dog"], "" | ["cat", "dog"] |
There are extra hidden tests, so make it work in general, not just for these.
What do they all share
Write a function called common_start
Return the longest opening piece that every word in the list begins with. ["cat", "car", "cap"] all start with "ca", so that is the answer. If they do not share even their first letter, return an empty string, and do the same for an empty list. A list holding one word shares the whole of that word.
Examples
| Input | Output |
|---|---|
| ["cat", "car", "cap"] | "ca" |
| ["cat", "dog"] | "" |
| [] | "" |
| ["cat"] | "cat" |
There are extra hidden tests, so make it work in general, not just for these.
Finish Rung 1 and today counts. Rungs 2 and 3 are there if you want to push further.