Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

Tests 25, 26 and 27 are not running. The output on the console is correct but the tests do not acknowledge it

Your code so far

test_settings = {
    "theme" : "dark",
    "notifications" : "enabled",
    "volume" : "high"
   
}
test_settings2 = {}
user_configuration = [test_settings]
def add_setting(settings_dictionary, tuple_pair):
    key, value = tuple_pair
    key = str(key).lower()
    value = str(value).lower()
    if key in settings_dictionary:
        return f"Setting '{key}' already exists! Cannot add a new setting with this name."
    settings_dictionary[key] = value
    return f"Setting '{key}' added with value '{value}' successfully!"

add_setting(test_settings, ("theme", "light"))

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

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

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

result = view_settings(test_settings)
print(result)

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

What your code shows in the console:

Current User Settings: 
Theme : dark
Notifications : enabled
Volume : high

What is expected, per the instructions:

Current User Settings:
Theme: dark
Notifications: enabled
Volume: high

Do you see the differences in spacing?

You can also test like this: print(repr(result)) to see newlines and spaces better.

1 Like

Thank you very much. The spacing was the issue

@dhess the last test is still not running. It says I should display the correct results, which is displaying on the terminal and end with a newline character. The last test is not running

I found the solution to the problem. There was a space after the “Current User Settings: \n” instead of “Current User Setting:\n”

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