0
0
Intro to Computingfundamentals~10 mins

Dictionaries and key-value pairs in Intro to Computing - Draw & Build Visually

Choose your learning style9 modes available
Draw This - beginner

Draw a diagram to represent a dictionary that stores the names of three fruits as keys and their colors as values. Use the following data: Apple - Red, Banana - Yellow, Grape - Purple.

5 minutes
Hint 1
Hint 2
Hint 3
Grading Criteria
Keys and values are clearly labeled
Each key has exactly one arrow pointing to its value
All three key-value pairs from the prompt are included
Boxes or shapes are used to represent keys and values
Arrows or lines correctly connect keys to their values
Solution
  +---------+       +-------+
  |  Apple  | ----> |  Red  |
  +---------+       +-------+

  +----------+      +---------+
  |  Banana  | ----> | Yellow |
  +----------+      +---------+

  +---------+       +---------+
  |  Grape  | ----> | Purple  |
  +---------+       +---------+

This diagram shows a dictionary with three key-value pairs. Each key (fruit name) is inside a box on the left. An arrow points from each key to its value (color) on the right. This visually represents how a dictionary stores data: each key is linked to a specific value.

For example, the key "Apple" points to the value "Red", meaning the color of an apple is red. Similarly, "Banana" points to "Yellow", and "Grape" points to "Purple".

Variations - 2 Challenges
[intermediate] Draw a diagram for a dictionary storing four countries as keys and their capitals as values: France - Paris, Japan - Tokyo, Brazil - Brasília, Canada - Ottawa.
[advanced] Draw a flowchart that shows how to look up a value in a dictionary given a key. Use the example dictionary: Dog - Bark, Cat - Meow, Cow - Moo.