Build a User Configuration Manager

def add_setting(setting: dict, new_pair: tuple) -> str:

    key, value = new_pair

    key = key.lower()

    

    if isinstance(value, str):

        value = value.lower()



    if key in setting:

        return f"Setting '{key}' already exists! Cannot add a new setting with this name."

    else:

        setting\[key\] = value

        return f"Setting '{key}' added with value '{value}' successfully!"




def update_setting(setting: dict, update_pair: tuple) -> str:

    key, value = update_pair

    key = key.lower()

    

    if isinstance(value, str):

        value = value.lower()



    if key in setting:

        setting\[key\] = value

        return f"Setting '{key}' updated to '{value}' successfully!"

    else:

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

This code is raising an error but i don’t know what the error is…..

Welcome to the forum @alexandra20 !

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').


How do you know your code is raising an error? How are you testing it? Are you seeing an error in the console? Are you seeing an error from running the tests?

Happy coding!