← back to unit
Challenge
# searching advanced
How Many Unique Words?
The poet brags about a huge vocabulary — count how many DIFFERENT words the poem actually uses. 📜
You get the poem as a list of words. Print how many distinct words appear, counting repeats only once. (The slow way: loops and a list, no shortcuts.)
Example:
Input: words = ["the", "cat", "and", "the", "hat"]
Output: 4
Building a seen-list one word at a time, "the" repeats but "cat", "and", and "hat" are all new — 4 distinct words.
💡 need a hint?
srch-unique-words.py🔒 given lines are locked — write your code in between
loading...