Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

Test 27 still failing, but the result looks ok. I tried to see what repr() function return and as I saw in another post, it looks the same as shown there.

Your code so far

def add_setting(settings, values):
    key, value = values

    if key.lower() in settings:
            return f"Setting '{key.lower()}' already exists! Cannot add a new setting with this name."
    else:
        settings[key.lower()] = value.lower()
        return f"Setting '{key.lower()}' added with value '{value.lower()}' successfully!"
    pass

def update_setting(settings, values):
    if not values[0].lower() in settings:
        return f"Setting '{values[0].lower()}' does not exist! Cannot update a non-existing setting."
    else:
        settings[values[0].lower()] = values[1].lower()
        return f"Setting '{values[0].lower()}' updated to '{values[1].lower()}' successfully!"

def delete_setting(settings, key):
    key = key.lower()
    if key in settings.keys():
        settings.pop(key)
        return f"Setting '{key}' deleted successfully!"
    else:
        return "Setting not found!"

def view_settings(test_settings):
    if not test_settings:
        return "No settings available."
    else: 
        view = "Current User Settings:\n"
        for key, value in test_settings.items():
            view += f"{key.capitalize()}: {value.lower()}\n"
        return view

test_settings = { 'theme': 'Dark', 'notifications': 'enabled', 'size': 'high' }

#print(repr(view_settings(test_settings)))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a User Configuration Manager - Build a User Configuration Manager

It’s a little vague but there’s no instruction to format the values as lowercase in the output.

I forgot to remove that formatting. Earlier I tried different things and it didn’t work, but I removed the lower() call and it works :slight_smile:

1 Like