0%
⭐ 0 XPPractice
Pack 2 · Challenge 5 of 5 · 10 XP · ⏱ 7 min

Name Keeper

🧾 Last rep: a two-message chat where Pip has to remember your name. Every message goes into the history, Pip's replies too.

messages = [{"role": "user", "content": "Hi!"}]
reply = pip.chat(messages)
messages.append({"role": "assistant", "content": reply})

Instructions

  1. Start messages with the user saying My name is Zara.
  2. Print pip.chat(messages) and add Pip's reply to messages as the assistant.
  3. Add the user asking What is my name?, then print pip.chat(messages).
💡 Hint

Three appends in total: user, assistant, user. Print after the first pip.chat and after the second.

Ask the community

bot.py
Terminal
← BackNext →

Prompt Gym

All practice packs

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.