Practice ยท 2 of 2
Toolkit: Frequency Report
Using Counter, write top_words(text, n) that returns the n most common lowercase words as a list of (word, count) tuples (ties: higher count first, then insertion order โ Counter handles it). Print top_words(text, 2) for text = \"to be or not to be\" as two lines in the form: word=4
Difficulty: beginner
Press Submit to check your solution.
Back to lesson: Practice: Mini Build: Utility Toolkit