Tell us what’s happening:
Hi i have already converted key to lowercase in update_setting function but i am still being prompted on it. Can’t seem to identify the issue here. Can someone please assist on this?
Your code so far
test_settings = {
'theme': 'dark',
'Brightness': '75',
'Notifications': 'enabled',
'Volume': 'high'
}
def add_setting(settings, key_val):
if isinstance(key_val, tuple):
key, val = key_val
key = key.lower()
val = val.lower()
print(key, val)
for setting in settings.items():
if key in setting:
return f"Setting '{key}' already exists! Cannot add a new setting with this name."
break
else:
settings[key] = val
return f"Setting '{key}' added with value '{val}' successfully!"
break
def update_setting(settings, keyval):
key, val = keyval
key = key.lower()
val = val.lower()
if key in settings.items():
settings.update([keyval])
print(settings)
return f"Setting '{key}' updated to '{val}' successfully!"
else:
return f"Setting '{key}' does not exist! Cannot update a non-existing setting."
def delete_setting(settings, keyval):
key, val = keyval
key = key.lower()
val = val.lower()
def view_setting(settings):
if not settings:
return 'No settings available.'
else:
pass
add_setting({'theme': 'light'}, ('THEME', 'dark'))
update_setting({'theme': 'light'}, ('VOLUME', 'dark'))
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 Edg/146.0.0.0
Challenge Information:
Build a User Configuration Manager - Build a User Configuration Manager