Repository navigation
python-quest: is there a strict prompts→questions→answers naming convention? #20
|
The quest folder has |
Replies: 1 comment
|
The mapping is name-based, not positional — The current tree actually proves the convention drifted beyond the prompts: 73 prompts are written in
If the convention should be mechanical, a five-line check script makes it self-enforcing: from pathlib import Path
root = Path(__file__).parent
questions = {p.stem for p in (root / "questions").glob("*.md")}
answers = {p.stem for p in (root / "answers").glob("*.py")}
missing_answers = questions - answers - {"README"}
missing_questions = answers - questions
print("answers missing:", sorted(missing_answers) or "none")
print("questions missing:", sorted(missing_questions) or "none")Run it as part of the quest workflow (or a pre-commit hook) and the |
The mapping is name-based, not positional —
prompt → questions/<name>.md → answers/<name>.py, keyed on the exercise name (the Go filename minus extension, with subdirectories flattened: prompt 11'sboolean/main.gobecomesboolean_main.md/.py). The prompt file's numbering is just documentation of the translation batches; nothing in the tree enforces the 1:1:1 mapping.The current tree actually proves the convention drifted beyond the prompts: 73 prompts are written in
piscine_python_prompts.md, but there are 112 questions and 111 answers — questions were evidently added past the translated batches. The convention still holds pairwise (everyquestions/<name>.mdmatchesanswers/<name>.pyby …