Build a User Configuration Manager - Step 4

test_settings = dict()
key_value_pair = tuple()

def add_setting(test_setting,key_value_pair):
    
    key = key.lower()
    value = value.lower()
    if not key in test_settings:
        return f"Setting {key} added with value {value} successfully"
       
    elif key not in test_settings:
         return f"Setting {key} already  exists! Cannot add a new setting with this name"
    

add_setting({"theme":"light"},("THEME","dark"))

Build a User Configuration Manager: Build a User Configuration Manager | freeCodeCamp.org
I am very confused on what the instructions are asking for. I am also a little under practiced due to how sparse the activities are in the section. Is there any other outside platform activities and explanations to continue practicing.

Alot of youtube videos I searched for have a different syllabus priority for different subjects.

Hi there,

Traceback (most recent call last):
  File "main.py", line 15, in <module>
  File "main.py", line 6, in add_setting
UnboundLocalError: cannot access local variable 'key' where it is not associated with a value

I’m seeing this error in the console.

If you google “Python tutorial for beginners”, you should get a good selection.

Happy coding!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.