promptdojo_

pathlib — the file API AI should reach for first — 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. Write a function merge_logs(folder) that:

  1. Globs for all *.log files in folder (sorted by name).
  2. Reads each file's text.
  3. Returns a single string with the contents of all logs joined, each separated by a single newline. Trailing newlines are fine.

The starter creates three log files. Calling the function should print exactly:

--a--
--b--
--c--

(Each file's content is --<letter>--\n. Concatenated they form three lines.)

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