Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

i cant pass tests 12 and 15.

i absolutelly dont understand why i cant pass 12 test, cuz lowercase call is the same as in add-function

and in test 15 the value is changing, but still not complete

Your code so far

test_settings = {
    'theme': 'light', 
    'notifications': 'enabled', 
}

def add_setting(dict1, tuple1):
    
    #getting key and value from tuple
    key = tuple1[len(tuple1)-2].lower()
    value = tuple1[len(tuple1)-1].lower()
    keylist = list(dict1.keys())

    #check for match
    if key == keylist[0]:
        return f"Setting '{key}' already exists! Cannot add a new setting with this name."
    else: dict1[key] = value
    return f"Setting '{key}' added with value '{value}' successfully!"

def update_setting(dict1, tuple1):
    
    #getting key and value from tuple
    key = tuple1[len(tuple1)-2].lower()
    value = tuple1[len(tuple1)-1].lower()
    keylist = list(dict1.keys())

    #check for match
    for i in range(len(keylist)-1):
        if key == keylist[i]:
            dict1[key] = value
            return f"Setting '{key}' updated to '{value}' successfully!"

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

update_setting(test_settings, ('theme', 'dark'))
update_setting(test_settings, ('volume', 'high'))

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 OPR/123.0.0.0

Challenge Information:

Build a User Configuration Manager - Build a User Configuration Manager

please share all your code, it is not possible to debug with only part of it

i’ve updated the code. there’s somehow the “Your browser infomation:“ thing was in my code…

if I update test_settings

test_settings = {
    'theme': 'light', 
    'notifications': 'enabled', 
    'volume': 'low'
}

and then try

update_setting(test_settings, ('volume', 'HIGH'))

test_settings is not updated

try adding print everywhere, make sure that each value is what you expect

oh god, why do i’m even put “-1” in the loop?..