Skip to content

Latest commit

 

History

History
39 lines (32 loc) · 1.49 KB

README.md

File metadata and controls

39 lines (32 loc) · 1.49 KB

[Deprecated] Candy Exercise

The current version of this activity has been migrated to Ada-Activites.

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.