Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

I cannot do steps 4 and 5 on this project. It wants me to return the key and value to lowercase. I can print both the key and value and it is lowercase. What am I doing wrong. Thank you for the help.

Your code so far

test_settings = {
    'Theme': 'dark',
    'Notifications': 'enabled'
}
new_settings = ('Volume','High')

def add_setting(settings, new_setting):
    key, value = new_setting
    key = key.lower()
    # I can print the key and it turns out as: 'volume', so what is wrong?
    value = value.lower()
    if key in settings:
            return f"Setting '{key}' already exists! Cannot add a new setting with this name."
    else:
        test_settings.update({key:value})
        return f"Setting '{key}' added with value '{value}' successfully!"
 
print(add_setting(test_settings,new_settings))

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

Challenge Information:

Build a User Configuration Manager - Build a User Configuration Manager

Is it adding the setting to the correct object?

First time i’m helping debug someone else’s code. I very well might be wrong. But I think it’s maybe cuz you’re trying to update test_settings directly. Try settings.update({key:value}).

Dumb mistake. thanks for the help.

1 Like

This is quite an achievement for me lol.