Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

good evening legends, i need help with user story 25 and 27 this is my code below:

def view_settings(dictionary):

message = ("Current User Settings:""\n")
if dictionary == {}:
    return 'No settings available.'
for key, value in dictionary.items():
    message += f"{key.title()}:{value}" + "\n"

return message 

Your code so far

def add_setting(dictionary, key_value_pair):
    key = key_value_pair[0].lower()
    value = key_value_pair[1].lower()

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

def update_setting(dictionary, key_value_pair):
    key = key_value_pair[0].lower()
    value = key_value_pair[1].lower()

    if key in dictionary:
        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 view_settings(dictionary):

    message = ("Current User Settings:""\n")
    if dictionary == {}:
        return 'No settings available.'
    for key, value in dictionary.items():
        message += f"{key.title()}:{value}" + "\n"

    return message 

def delete_setting(dictionary,my_key):
    key = my_key.lower()

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

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

mine = {}

print(view_settings(test_settings))

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

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

Your browser information:

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

Challenge Information:

Build a User Configuration Manager - Build a User Configuration Manager

Welcome to the forum @justprecious1234!

Try removing the parentheses and extra doubles quotes from the initial setting for message.

And check your spacing of the key/value settings that are printed.

Happy coding!

Thanks for the prompt help dhess, yes it was the key/value settings that needed a space as Key: value and it has now been resolved