← All practice pages
Python
Python Dictionaries & Sets
Dictionaries store values under keys instead of positions, so lookups are fast and readable. Sets store unique values with no order.
Try it now
Optimize a word frequency counter that uses nested loops and manual counting. Replace with collections.Counter and proper dict comprehensions.
Create a free account to run your answer and get ARIA's review.