Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

I seem not to understand why test 25 fails and says “view_Settings should return formatted strings for non-empty dictionary”

Your code so far

def add_setting(diction,tupel):
     lower_t = tuple(item.lower() for item in tupel)
     if lower_t[0] in set(diction.keys()):
         return f"Setting '{lower_t[0]}' already exists! Cannot add a new setting with this name."
     else:
          diction.update({lower_t[0]:lower_t[1]})
          return f"Setting '{lower_t[0]}' added with value '{lower_t[1]}' successfully!"
     
def update_setting(up_diction,up_tupel):
    lower_u = tuple(content.lower() for content in up_tupel)
    x = lower_u[0]
    y = lower_u[1]
    if x in set(up_diction.keys()):
        up_diction[x] = y
        print(up_diction)
        return f"Setting '{x}' updated to '{y}' successfully!"
    else:
         return f"Setting '{x}' does not exist! Cannot update a non-existing setting."
        
def delete_setting(para_1,para_2):
     d = para_2.lower()
     print(d)
     if d in set(para_1.keys()):
         para_1.pop(d)
         print(para_1)
         return f"Setting '{d}' deleted successfully!"
     else:
         return f"Setting not found!"
        
def view_settings(view_diction):
     if view_diction == {}:
         return f'No settings available.'
     else:
         print("Current User Settings:")
         for key,value in view_diction.items():
             print(f"{key.title()}:{view_diction[key]}\n")

          



test_settings = {
    'Theme':'dark',
    'Language':'English',
    'Notifications':'enabled'
}
print(add_setting({'theme': 'light'}, ('THEME','dark')))
print(add_setting({'theme': 'light'}, ('volume', 'high')))
print (update_setting({'theme': 'light'}, ('theme', 'dark')))
print(update_setting({'theme': 'light'}, ('volume', 'high')))
print(delete_setting({'theme': 'light'}, 'theme'))
print(view_settings({}))
print(view_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/146.0.0.0 Safari/537.36

Challenge Information:

Build a User Configuration Manager - Build a User Configuration Manager

Hi @couragekumahkojo ,

What is that function returning?

Happy coding!

I have seen my mistake ….. thanks