BeginnerCoder

Lesson 17 — Mini project: unique words

Mini project: a tiny word-statistics tool

Real text is messy: "The" and "the" should count as one word, and "dog." should not differ from "dog". Normalise first: lowercase everything and strip punctuation. Then combine structures: a set for unique words and a Counter for frequencies.

"Dog.".lower().strip(".,!?")   # "dog"

Why it matters: search engines, spam filters and AI language models all start with exactly this kind of text clean-up.

Want it another way?
Task

Normalise each word (lowercase + strip ".,!?"), then build unique with a set. Expected: 7 unique words.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.

Keep going with Data Structures

Ready for more? Optional paid resources that pick up where this lesson leaves off.

Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.