Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

Tests 7 and 27 are not validating but they don’t create error messages

Your code so far


test_settings = {
    'Theme': 'light',
    'Language': 'English',
    'Notifications': 'Enabled'
}

def add_setting(settings, new_setting):
    key, value = new_setting
    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, new_setting):
    key, value = new_setting
    key = key.lower()
    value = value.lower()
    
    if key in settings:
        settings[key] = value
        return f"Setting '{key}' updated to '{value}' successfully!"
    
    return f"Setting '{key}' does not exist! Cannot update a non-existing setting."

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

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

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Build a User Configuration Manager - Build a User Configuration Manager

What are the failed tests telling you in the console when you run the tests?

add_setting({'theme': 'light'}, ('volume', 'high')) should add a new key-value pair and return the success message Setting 'volume' added with value 'high' successfully!.
27. view_settings should display the correct results and end with a newline character.

What does this tell you?

Test 27 seems like an easy win. Try looking at that first.

OMG Thanks, after staring for so long i just couldn’t see it. now I’m sure i can figure out 7

1 Like

Focus on the tests one at a time.

Make sure the instructions (User Stories) are implemented exactly as described. They are precise in their language. See if it can be broken down into smaller steps.