Skip to content

dsarm-edu/candy_exercise

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Directions

  1. In get_friends_favorite_candy_count(), return a dictionary of candy names and the amount of times each candy appears in the friend_favorites list.
friend_favorites = [
    ["Sally", ["lollipop", "bubble gum", "laffy taffy" ]],
    ["Bob", ["milky way", "licorice", "lollipop" ]],
    ["Arlene", ["chocolate bar", "milky way", "laffy taffy" ]],
    ["Carlie", ["nerds", "sour patch kids", "laffy taffy" ]]
]
  1. Given the list friend_favorites, create a new data structure in the function create_new_candy_data_structure that describes the different kinds of candy paired with a list of friends that like that candy.
friend_favorites = [
    ["Sally", ["lollipop", "bubble gum", "laffy taffy" ]],
    ["Bob", ["milky way", "licorice", "lollipop" ]],
    ["Arlene", ["chocolate bar", "milky way", "laffy taffy" ]],
    ["Carlie", ["nerds", "sour patch kids", "laffy taffy" ]]
]
  1. In get_friends_who_like_specified_candy(), return a tuple of friends who like the candy specified in the candy_name parameter.

  2. In, create_candy_set(), return a set of all the candies from the data structure made in create_new_candy_data_structure().

  3. Starting with nominal cases, write tests for each of the functions in the file tests/test_candy_data_structure.py then write tests to handle edge cases.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%