Tell us what’s happening:
i am not sure why my code is not passing the tests, even though when i manually insert the test, i am able to receive the desired return value
Your code so far
def add_setting(current, change):
current = {keys.lower() : values.lower() for keys, values in current.items()}
key = change[0].lower()
value = change[1].lower()
if key in current:
return print(f"Setting '{key}' already exists! Cannot add a new setting with this name.")
current[key] = value
return print(f"Setting '{key}' added with value '{value}' successfully!")
def update_setting(current,change):
current = {keys.lower() : values.lower() for keys, values in current.items()}
key = change[0].lower()
value = change[1].lower()
if key in current:
current.update({key : value})
return print(f"Setting '{key}' updated to '{value}' successfully!")
else:
return print(f"Setting '{key}' does not exist! Cannot update a non-existing setting.")
def delete_setting(current, key):
current = {keys.lower() : values.lower() for keys, values in current.items()}
key = key.lower()
if key in current:
current.pop(key)
return print(f"Setting '{key}' deleted successfully!")
else:
return print(f'Setting not found!')
def view_settings(current):
if current == {}:
return 'No settings available.'
print(f"Current User Settings:")
for key, value in current.items():
print(f'{key.title()}: {value}')
test_settings = {'Brightness' : 'BRIGHT', 'Difficulty' : 'Hard'}
new = ('Adlan', 'Cool')
#add_setting(test_settings, new)
#add_setting({'theme': 'light'}, ('THEME', 'dark'))
#view_settings({'theme': 'dark', 'notifications': 'enabled', 'volume': 'high'})
#delete_setting({'theme': 'light'}, 'teme')
update_setting({'theme': 'light'}, ('theme', 'dark'))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Build a User Configuration Manager - Build a User Configuration Manager