Tell us what’s happening:
I dont understand, i have done what is required but it still does not pass? im not quite sure what else i have to do
Your code so far
test_settings = {
'theme': 'light',
'language': 'portuguese',
'notifications': 'off',
}
settings = [test_settings]
def add_setting(dictionary, key_value):
key, value = key_value
key = key.lower()
value = value.lower()
if key in dictionary:
print(f"Setting '{key}' already exists! Cannot add a new setting with this name.".lower())
return False
else:
dictionary[key] = value
print(f"Setting '{key}' added with value '{value}' successfully!".lower())
return True
add_setting({'theme': 'light'}, ('THEME', 'dark'))
add_setting({'theme': 'light'}, ('volume', 'high'))
def update_setting(dictionary, key_value):
key_update, value_update = key_value
key_update = key_update.lower()
value_update = value_update.lower()
if key_update in dictionary:
dictionary[key_update] = value_update
print(f"Setting '{key_update}' updated to '{value_update}' successfully!")
return True
else:
print(f"Setting '{key_update}' does not exist! Cannot update a non-existing setting.")
return False
update_setting({'theme': 'light'}, ('theme', 'dark'))
update_setting({'theme': 'light'}, ('volume', 'high'))
def delete_setting(dictionary, key):
key = key.lower()
if key not in dictionary:
print("Setting not found!")
return False
del dictionary[key]
print (f"Setting '{key}' deleted successfully!")
return True
delete_setting({'theme': 'light'}, 'theme')
delete_setting({'theme': 'light'}, 'stuff')
print(test_settings)
def view_settings(dictionary):
if not dictionary:
return "No settings available.\n"
output = ["Current User Settings:"]
for key, value in dictionary.items():
output.append(f"{key.capitalize()}: {value}")
return "\n".join(output) + "\n"
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; rv:146.0) Gecko/20100101 Firefox/146.0
Challenge Information:
Build a User Configuration Manager - Build a User Configuration Manager