The Fallback Layer
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L3
Problem
A service builds its runtime config by layering environment values over a baseline. Start from `primary`, the values read from the environment, and keep every key it has; whenever one of those values is `None`, fall back to the same key in `defaults`. A key that lives only in `defaults` never makes it into the result, and a `None` with no matching default stays `None`.
Summary
When the live values come back empty, something has to stand in.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.