0%
⭐ 0 XPMap
Chapter 4 · Quest 1 of 5 · 10 XP

Sticky Note

🗒️ Your bot forgets everything the moment a program ends. Memory starts small: a dictionary of sticky notes. You can add a new key at any time, or write over one:

notes = {}
notes["snack"] = "popcorn"
notes["snack"] = "nachos"
print(notes)
{'snack': 'nachos'}

.get(key, backup) reads a note, or gives back the backup if the key isn't there, instead of crashing.

Instructions

  1. Make an empty dict called notes.
  2. Make remember(key, value) that stores the value in notes.
  3. Make recall(key) that returns the note, or I don't remember that.
  4. Remember that "color" is "teal", then print recall("color").
💡 Hint

remember does notes[key] = value. recall does return notes.get(key, "I don't remember that.").

Ask the community

bot.py
Terminal
← BackNext →

Chapter 4: Memory

The full quest map

Talk it out

  1. Read the instruction with the ✗ out loud.
  2. Say what your code does, line by line, as if to a friend.
  3. Find the line where what it does and what you want split apart.
  4. Press Run and read the terminal. Is that what you expected?
  5. Still stuck? Press Ask Pip why, or peek at the solution.
  6. Or ask on the community help board: say which quest, and paste your code.
New badge!

Your bot just got a new part. See it on the quest map.

Name your bot

It levels up as you play, and gets a new part with every chapter.