promptdojo_

pathlib — the file API AI should reach for first — step 8 of 9

Write a function list_text_files(folder) that returns a list of the names (not full paths) of all .txt files directly inside folder, in sorted order.

Use Path.glob("*.txt") to find them. Use .name to get just the filename from each Path. Wrap the result in sorted(...).

The starter creates three files in /tmp/notes/. Calling the function should produce:

['alpha.txt', 'beta.txt']

(The .md file is filtered out by the glob.)

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