Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

I cant seem to implement 25 and 27 correctly, nothing has worked as of yet… I think it has to do with the final return statements but i am unsure. I have tried using capitalize and title and nothing improved or worsened. I am talking about the view_settings function.

Your code so far

test_settings = {
        'brightness': 20,
        'sensitivity': 0.5,
        'fps_cap': 144,
        'theme': 'light'
    }

def add_setting(setting, key_val):
    key, val = key_val
    
    key = key.lower()
    val = val.lower()

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

add_setting({'theme': 'light'}, ('THEME', 'dark'))
add_setting({'theme': 'light'}, ('volume', 'high'))


def update_setting(setting, key_val):
    key, val = key_val
    
    key = key.lower()
    val = val.lower()

    if key in setting:
        setting.update({key: val})
        return f"Setting '{key}' updated to '{val}' successfully!"
    
    else:
        return f"Setting '{key}' does not exist! Cannot update a non-existing setting."


update_setting({'theme': 'light'}, ('theme', 'dark'))
update_setting({'theme': 'light'}, ('volume', 'high'))

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

    if key in setting:
        setting.pop(key)    
        return f"Setting '{key}' deleted successfully!"

    else:
        return f"Setting not found!"

delete_setting({'theme': 'light'}, 'theme')

def view_settings(setting):
    if not setting:
        return "No settings available."

    result = []
    for key in setting:
        capitalized_key = key.title()
        result.append(f"{capitalized_key}: {setting[key]}")

    return "\n".join(result) + "\n"

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) 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

The string should start with Current User Settings: followed by the key-value pairs, each on a new line and with the key capitalized.

Does your code satisfy this requirement?