──────────────────────────────────────

37. Pocket Quiz Capstone · Write the Quiz Brief

Turn a vague project idea into inputs, outputs and three examples.

Lesson files · lessons/foundations-capstone/plan-a-tool

Before you start
- Store several strings in a list.
- Use len() to count the items in a list.
- Describe a test with its input and expected output.

By the end
- Use a short brief to record the quiz prompts and answer keys.
- Use the list length to report the number of prompts.
- Describe a test that will catch a problem with cleaning a reply.

Where you can use it
Plan a quiz for a school event. Write the questions, answer keys and a few example replies so a friend can check what should happen.

A quiz brief tells a player what to enter, how the game scores it and what appears at the end. Give each question a prompt and an answer key. Pocket Quiz reads one answer per line and gives one point for a correct reply.

Write down three ways to try the quiz. Include a correct reply, a reply with extra spaces and a blank reply. Record the result you expect for each case before you write the program.

Predict
Which is a stronger test description?
- Input Mars, expect a correct answer.
- See if it works.

Worked example (example.py)

questions = ["Name the red planet.", "What is 2 + 2?"]
print(f"Questions: {len(questions)}")


Example result
Questions: 2

Write three quiz prompts with answer keys for your brief. Put the prompts in a Python list and use its length to print Questions: 3. Record one test from your brief in the reflection.

Starter program (starter.py)

questions = ["Name the red planet.", "What is 2 + 2?"]
print(f"Questions: {len(questions)}")


Hint
Add a third string to the list. Let len() count the questions.

Case 1. Try the sample
Input
(No input.)
Expected output
Questions: 3

Stretch
Ask someone to read your tests and predict the score using only your brief.

Reflect
Which of your planned cases would catch a bug in input cleaning?

Check your prediction
Input Mars, expect a correct answer. A specific input and expected result can be repeated by anyone.
