Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

Hello, I have reached step 27 and can’t get past it even though I have a newline character at the end, can someone spot where I have made a mistake?

Your code so far

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

def add_setting(set_dictionary, kv_tuple):
    key = kv_tuple[0].lower()
    value = kv_tuple[1].lower()
    if key in set_dictionary:
        return f"Setting '{key}' already exists! Cannot add a new setting with this name."
    if not key in set_dictionary:
        set_dictionary.update({ f'{key}': f'{value}' })
        return f"Setting '{key}' added with value '{value}' successfully!"

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

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

def view_settings(set_dictionary):
    if not set_dictionary:
        return 'No settings available.'
    if set_dictionary:
        starter = ""
        for setting in set_dictionary.items():
            user_settings = setting[0].capitalize() + ": " + setting[1] + "\n" 
            starter += user_settings
        return "Current User Settings:" + "\n" + starter + "\n"


print(view_settings(test_settings))
print(test_settings)

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15

Challenge Information:

Build a User Configuration Manager - Build a User Configuration Manager

Change your print as follows so you can see all of the newline characters:

print(repr(view_settings(test_settings)))

Thank you so much, I just had an \n too much at the end! :slight_smile: