Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

i don’t know why it is not working it gives me the correct output but … it just says
view_settings should display the correct results and end with a newline character.

Your code so far

def add_setting(settings, pair):
    key, value = pair
    key = key.lower()
    value = value.lower()

    if key in settings:
        return f"Setting '{key}' already exists! Cannot add a new setting with this name."

    settings[key] = value
    return f"Setting '{key}' added with value '{value}' successfully!"

def update_setting(settings, pair):
    key, value = pair
    key = key.lower()
    value = value.lower()

    if key not in settings:
        return f"Setting '{key}' does not exist! Cannot update a non-existing setting."

    settings[key] = value
    return f"Setting '{key}' updated to '{value}' successfully!"

def delete_setting(settings, key):
    key = key.lower()

    if key not in settings:
        return "Setting not found!"
    
    del settings[key]
    return f"Setting '{key}' deleted successfully!"

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


test_settings = {
    "theme": "dark",
    "notifications": "enabled",
    "volume": "high",
}

print(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/142.0.0.0 Safari/537.36

Challenge Information:

Build a User Configuration Manager - Build a User Configuration Manager

are you sure you are doing this?

me too, I also add a “\n“ to the end with , such as “result += f"\n{key.capitalize()}: {value}"“, but I don’t know why it is not working it gives me the correct output but … it just says view_settings should display the correct results and end with a newline character.

Please open your own thread

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Get Help > Ask for Help button located on the challenge.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.