promptdojo_

open() — and the with-block AI keeps forgetting — step 9 of 9

Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Last drill — the JSON pattern AI uses on every config file.

  1. Import json.
  2. Write a dict {"app": "promptdojo", "users": 1} to /tmp/config.json using json.dump(data, f) inside a with block.
  3. Read it back with json.load(f).
  4. Print the value of the "app" key.

Expected output:

promptdojo

full-screen editor opens — close anytime to keep reading.