Merge dicts summing values
Write a function that merges two dictionaries by summing values for duplicated keys.
Missing keys default zero
Write a function to sum numeric values from dictionaries, treating missing keys as zero.
Keys Sorted by Value Descending
Given a dictionary mapping strings to integers, return a list of keys sorted by value descending, and when values tie, alphabetically ascending.
Common Keys of Two Dictionaries
Implement a function that finds keys shared by two dictionaries and returns them sorted.
Top k keys by count
Given a dictionary mapping keys to counts, return the top k keys with the highest counts, breaking ties alphabetically.
Replace keys with a mapping
Write a function that renames keys in a dictionary according to a mapping, with duplicate handling.
Showing 6 challenges · easy · Dicts & Sets
Dicts & Sets — Python coding challenges
What you will find here
This page lists dicts & sets challenges — real Python problems you solve in the browser IDE with instant test feedback. Each challenge includes a clear brief, starter code, and automated checks.
Challenges vs tutorials and quizzes
Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.