Tell us what’s happening:
I think there’s a typo in the description of test 6, which states " add_setting({‘theme’: ‘light’}, (‘THEME’: ‘dark’)) should return the error message Setting ‘theme’ already exists! Cannot add a new setting with this name.." The second argument of the function should be a tuple, so after ‘THEME’ it should be a comma instead of a colon. If we call the add_setting function with “{‘theme’: ‘light’}, (‘THEME’: ‘dark’)”, it should raise an syntax error.
Your code so far
def add_setting(settings, new_entry):
key, value = (item.lower() for item in new_entry)
if key in settings.keys():
return f'Setting \'{key}\' already exists! Cannot add a new setting with this name.'
else:
settings[key] = value
return f'Setting \'{setting[key]}\' added with value \'{setting[value]}\' successfully!'
print(add_setting({'theme': 'light'}, ('THEME', 'dark')))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
Challenge Information:
Build a User Configuration Manager - Build a User Configuration Manager