STEP 18: When a sprite is clicked, we get its image name. Let's use our dictionary to see how many points it's worth!

Dictionaries make it easy to find the value associated with a specific key.

  • In LOGIC, go to and drag Get Value Using Key inside your click event.
  • Change "cat" to image (no quotes). This is our key—the sprite's image label.
  • my_dictionary.get(image) will now return the key's value—the number of points the sprite is worth.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)