Skip to content

JoinCODED/TASK-Python-Dictionaries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Setup

  1. Fork the following repository.
  2. Make sure Python and VSCode are set on your device. You can use the references below.
  3. You will open the code ov VSCode and write the code in main.py.
  4. Run the code to test it.

Steps

  1. Create a dictionary called person, it has three properties, name which is a string, age which is an integer, hobbies which is a list of strings.
  2. Create a function called change_age which takes the person dictionary and a number as arguments, this function changes the age in the dictionary to the number. The return value of this function is the updated dictionary.
  3. Create a function called add_hobby which takes the person dictionary and a hobby as arguments. This function adds the hobby to the list of hobbies inside the person dictionary. The function will return the updated dictionary.

Challenge

  1. Create a function called add_job which takes a job which is a string, as an argument. This function checks, if the dictionary does not have a property called job then it will add it to the dictionary. The function will return the updated dictionary.
  2. Create a function called check_hobbies, which takes a person dictionary as an argument. This function checks the number of hobbies for this person, if it's more than three hobbies, print to the user a message telling them that they're talented.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages