Merge dicts summing values
Write a function that merges two dictionaries by summing values for duplicated keys.
Are two lists the same multiset
Write a function that checks if two lists contain the same elements with the same multiplicities, ignoring order.
Word to Index Map
Create a function that returns a dictionary mapping each unique word to the index of its first occurrence.
Missing keys default zero
Write a function to sum numeric values from dictionaries, treating missing keys as zero.
Nested get with dotted path
Implement a function that safely retrieves a value from a deeply nested dictionary using a dot-separated path, returning a default if any key is missing.
Common Keys of Two Dictionaries
Implement a function that finds keys shared by two dictionaries and returns them sorted.
Union of Many Sets
Implement a function that takes any number of sets and returns a sorted list of their union.
Mode of a list via counting
Implement a function that returns the mode of a list, resolving ties by the element that appears first.
Replace keys with a mapping
Write a function that renames keys in a dictionary according to a mapping, with duplicate handling.
Symmetric Difference
Write a function that computes the symmetric difference of two lists, returning a sorted list of unique elements.
Subset of another set
Write a function that checks if every element of one set is contained in another.
Frequency sort descending
Write a function that sorts a list by frequency descending while preserving original order for ties.
Count Pairs with Sum
Implement a function that counts the number of distinct pairs in a list summing to a target.
Hash map merge
Write a function that merges two dictionaries recursively, combining values and preserving structure.
Showing 14 challenges · 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.