Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

I cannot complete steps 25 and 27. I have them set to new lines for 27 and I have the defined “test_settings” keys and variables. I cant seem to get those two steps to pass. Please assist. Thank you

Your code so far

(test_settings) = {'Current User Settings': '' ,'theme': 'dark' ,'notifications': 'enabled' , 'volume': 'high' }

def add_setting(settings, key_value_pair):

    key, value = key_value_pair

    key = key.lower()

    value = str(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, key_value_pair):

    key, value = key_value_pair

    key = key.lower()

    value = value.lower()



    if key not in settings:

        return f"Setting '{key}' does not exist! Cannot update a non-existing setting."

    

    settings[key] = value

    return f"Setting '{key}' updated to '{value}' successfully!"



def delete_setting(settings, key):

    key = key.lower()

    

    if key not in settings:

        return "Setting not found!"

    

    del settings[key]

    return f"Setting '{key}' deleted successfully!"



def view_settings(settings):

    if not settings:

        return "No settings available."
     
    result = ""

    for key, value in settings.items():

        result += f"{key.title()}: {value}\n"
        result += "\n"  
    return result

#(test_settings) = {'Current User Settings': '' ,  'theme': 'dark' , 'notifications': 'enabled' , 'volume': 'high' }

print(view_settings(test_settings))



#set(test_settings) {'Current User Settings': ' ' ,'theme': 'dark', 'notifications': 'enabled', 'volume': 'high'}











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

Your output seems to be double spaced?

Current User Settings: 

Theme: dark

Notifications: enabled

Volume: high

This does not match the example

should return:

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

As well note from the user story

For example, view_settings({'theme': 'dark', 'notifications': 'enabled', 'volume': 'high'}) should return:

You should not be putting that string into the test settings like this:

test_settings = {'Current User Settings': '' ,'theme': 'da

Because that does not match the User Story.

I have tried several ways and matched the example. It has been removed from {value}/n and both steps still show as failed.

As well note from the user story

For example, view_settings({'theme': 'dark', 'notifications': 'enabled', 'volume': 'high'}) should return:

You should not be putting that string into the test settings like this:

test_settings = {'Current User Settings': '' ,'theme': 'da

Because that does not match the User Story.

I suggest you review the related User Stories and make sure they are implemented as described.

I am not really understanding where the issue is still sadly :frowning:

the issue is that you should not have the empty lines in the output, if you have made updates please share your updated code

(test_settings) = {‘Current User Settings’: ‘’ ,‘theme’: ‘dark’ ,‘notifications’: ‘enabled’ , ‘volume’: ‘high’ }

def add_setting(settings, key_value_pair):

key, value = key_value_pair

key = key.lower()

value = str(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, key_value_pair):

key, value = key_value_pair

key = key.lower()

value = value.lower()

if key not in settings:

return f"Setting ‘{key}’ does not exist! Cannot update a non-existing setting."

settings\[key\] = value

return f"Setting ‘{key}’ updated to ‘{value}’ successfully!"

def delete_setting(settings, key):

key = key.lower()

if key not in settings:

return “Setting not found!”

del settings\[key\]

return f"Setting ‘{key}’ deleted successfully!"

def view_settings(settings):

if not settings:

return “No settings available.”

result = “”

for key, value in settings.items():

result += f"{key.title()}: {value}"

result += “\\n”

return result

print(view_settings(test_settings))

#set(test_settings) {‘Current User Settings’: ’ ’ ,‘theme’: ‘dark’, ‘notifications’: ‘enabled’, ‘volume’: ‘high’}

you should not add this in test_settings, you should have Current User Settings in the output even if it’s not in the settings object

Thank you both. I found the issue within the function!
removed by moderator

Congratulations on solving the challenge! You should be proud of your achievement…we are! But we are removing your working solution, so it is not available to others who have not yet done the work to get there. Again, congrats!