MicrolearnENPTES

Project: word counter

Lesson 20 of 20 · Py.Micro

Combine strings, loops, dictionaries and functions in a real little tool.

text = "Coffee, more coffee! Coffee is life. Tea is fine."

Lowercase everything and replace punctuation with spaces, so "Coffee," and "coffee" count as the same word. .split() then cuts on spaces.

Check yourself

Why lowercase the text before counting?

Do it in the browser: a real Python tool, a short mission and instant feedback. No install.

Start this lesson — free
← Classes and objects

All lessons · Py.Micro