I’m not sure why tests 4 and 5 are currently not accepting.
I made sure key and value are lower cased.
def add_setting(settings, key_value_pair):
key, value = key_value_pair
key = key.lower()
value = value.lower()
if key in test_settings:
return f"Setting '{key}' already exists! Cannot add a new setting with this name."
test_settings = {
"brightness": 80,
"volume": 57,
"screen_mode": "dark",
"theme": "dark"
}
print(add_setting(test_settings, ("THEME", "Light")))
omegas
September 13, 2025, 2:08am
2
Complete your add_setting function and the test should pass. You still need to add the new value to the given key and return the success message.
So, I did finish the add_setting function and finished more of the project, but I still get tests 4 and 5 and even 7 off.
def add_setting(settings, new_pair):
key = new_pair[0].lower()
value = new_pair[1].lower()
if key in test_settings:
return f"Setting '{key}' already exists! Cannot add a new setting with this name."
else:
settings.update({ key:value })
return f"Setting '{key}' added with value '{value}' successfully!"
test_settings = {
"brightness": 80,
"volume": 57,
"screen_mode": "dark",
"theme": "dark"
}
print(add_setting(test_settings, ("Size_Screen", "LOW")))
def update_setting(settings, key_value_pair):
key, value = key_value_pair
key = key.lower()
value = value.lower()
I found the solution…it was a bit of a “DUH” moment.
I had the function check for my test settings dictionary instead of the parameter settings in the function.
1 Like
vszlx4
November 23, 2025, 12:31pm
5
Since 2022, the test criteria can only be validated if you’ve typed it the way “they” want!
def add_setting(x, y):
updated_y = tuple(i.lower() if isinstance(i, str) else i for i in y)
Even while this block of code can literally lowercase everything in the tuple that is a string, yet the criteria cannot validate it lol.
However, thanks for the help for such a silly issue, have a wonderful day!
ILM
November 23, 2025, 1:21pm
6
this project is not here since 2022, only 2025
things can change, if there is valid code that should pass you can open an issue on GitHub