Skip to content

ArieRS/FreeCodeCamp_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

FreeCodeCamp_Python

This repository for freecodecamp python certification

  1. Build a User Configuration Manager

    The solution can be seen on: UserConfigurationManager.py

    Problem: In this lab, you will build a User Configuration Manager that allows users to manage their settings such as theme, language, and notifications. You will implement functions to add, update, delete, and view user settings.

    Objective: Fulfill the user stories below and get all the tests to pass to complete the lab.

    User Stories:

    a. You should define a function named add_setting with two parameters representing a dictionary of settings and a tuple containing a key-value pair add_setting function should:

    Convert the key and value to lowercase. If the key setting exists, return Setting '[key]' already exists! Cannot add a new setting with this name. If the key setting doesn't exist, add the key-value pair to the given dictionary of settings and return Setting '[key]' added with value '[value]' successfully!. The messages returned should have the key and value in lowercase.

    b. You should define a function named update_setting with two parameters representing a dictionary of settings and a tuple containing a key-value pair. update_setting function should:

    Convert the key and value to lowercase. If the key setting exists, update its value in the given dictionary of settings and return: Setting '[key]' updated to '[value]' successfully! If the key setting doesn't exist, return Setting '[key]' does not exist! Cannot update a non-existing setting. The messages returned should have the key and value in lowercase.

    c. You should define a function named delete_setting with two parameters representing a dictionary of settings and a key. delete_setting function should:

    Convert the key passed to lowercase. If the key setting exists, remove the key-value pair from the given dictionary of settings and return Setting '[key]' deleted successfully! If the key setting does not exist, return Setting not found! The messages returned should have the key in lowercase.

    d. You should define a function named view_settings with one parameter representing a dictionary of settings. view_settings function should:

    Return No settings available. if the given dictionary of settings is empty. If the dictionary contains any settings, return a string displaying the settings. The string should start with Current User Settings: followed by the key-value pairs, each on a new line and with the key capitalized. For example, view_settings({'theme': 'dark', 'notifications': 'enabled', 'volume': 'high'}) should return:

    Current User Settings: Theme: dark Notifications: enabled Volume: high

    For testing the code, you should create a dictionary named test_settings to store some user configuration preferences.

About

This repository for freecodecamp python certification

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages