Loading...

Dictionary Key Intersection

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
medium
Seniority
senior

Problem

Our config reconciliation tool needs to find settings that exist in both production and staging. Write a function called intersect_dicts that takes two dictionaries and returns a new dict containing only shared keys, using values from the first dict, with keys in sorted order.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.