Sign in to run and submit your work
Reading is open to everyone. Running code and saving drafts need an account so your work is yours and comes back on your next visit.
or
CODE WORKSPACE
Every run of a job starts from one config template and applies its own overrides on top. The template is shared by every run in the process, so it has to come out of this function exactly as it went in.
Write apply_overrides(template, overrides). It returns the merged config, recursing into nested dicts rather than replacing them wholesale.
Function to write
apply_overrides(template: dict, overrides: dict) -> dictA new config dict with the overrides merged in, sharing no mutable object with either input.
How to approach it
Apply two different overrides to one template, then print the template.
Sample cases
+ 2 held back until you submit
override a nested list
A nested key is replaced while its siblings survive — `name` must still be warehouse.
Input
Argument 1
{
'sink': {
'name': 'warehouse',
'columns': [
'id',
'amount'
]
},
'retries': 3
}Argument 2
{
'sink': {
'columns': [
'id'
]
}
}Returns
{
'sink': {
'name': 'warehouse',
'columns': [
'id'
]
},
'retries': 3
}override a top-level value
The same template, a different override: the sink block comes back untouched and complete.
Input
Argument 1
{
'sink': {
'name': 'warehouse',
'columns': [
'id',
'amount'
]
},
'retries': 3
}Argument 2
{
'retries': 5
}Returns
{
'sink': {
'name': 'warehouse',
'columns': [
'id',
'amount'
]
},
'retries': 5
}no overrides at all
An empty override returns the template's values unchanged — a copy, not the template itself.
Input
Argument 1
{
'sink': {
'name': 'warehouse',
'columns': [
'id',
'amount'
]
},
'retries': 3
}Argument 2
{}Returns
{
'sink': {
'name': 'warehouse',
'columns': [
'id',
'amount'
]
},
'retries': 3
}Constraints
columns inside sink must leave name alone.Worked example
Apply {'sink': {'columns': ['id']}} to the template, then apply {'retries': 5} to the same template.
With the starter's dict(template) the first call replaces the whole sink block, losing warehouse. Worse, if it had merged instead, the shallow copy shares the columns list with the template — so appending to it would edit the template, and the second run would inherit the first run's columns with nothing in the code to explain why.
What this tests
That a shallow copy protects the outer container and nothing inside it, and that merging nested configuration is a recursive operation rather than a dict.update. Both failures are silent and both surface in the run after the one that caused them.
apply_overrides(template: dict, overrides: dict) -> dictSubmit for review to find out what your query gets right, what it gets wrong, and how it compares with the best working query for this exercise.
This scenario runs a full workspace — editor, canvas and results side by side. It needs a laptop or desktop to be usable. Open this page on a bigger screen to start building.