Week 4 — Yes-or-No Questions, Branches, and the Order of the Tests
Assignment 4 of the term — ask yes-or-no questions with comparisons, read a truth table, trace which branch of an if, elif, and else chain runs, find a logic error, and explain it all to someone who has never programmed.
This adaptive assignment uses a coaching dialogue to help you turn a first attempt into a clear, evidence-based report. You remain the author. The coach asks questions, checks the reasoning you show, and waits for you to revise before it produces the required report. This builds on Week 2's floor division: the reading log uses // to find half of its goal, and this week a comparison checks the pages read against that line. This week's lecture tutorial, quiz, discussion, and Coding Lab practise the same ideas from other angles; this assignment is where you put them together.
The task
A friend who coordinates a neighbourhood reading challenge has been using a short program to send readers a message, and something seems off. A reader with 45 pages logged was told Keep going, and a second program that turns a total into a letter told someone with 95 that they earned D or better. Your friend asks, "Is the computer broken?" Your job is to check what Python really did, the way a programmer would: predict each result before you run it, run it in a free browser Python runner, and explain what happened. All four problems are illustrative and use this week's reading log, where goal = 300 and pages_read = 45, and this week's truth tables.
Work these four problems. For each one, write your prediction first, then run the code and write the actual output beside your prediction:
- In the reading log's Week 4 stage,
goal = 300and the elif line testspages_read >= goal // 2. What number doesgoal // 2give, the halfway line that test compares against? - With
goal = 300andpages_read = 45, how many more pages must be read before the elif testpages_read >= goal // 2first comes outTrue? - Down the four rows of a truth table, in the order True True, True False, False True, False False, on how many rows does
not a or bgiveTrue? - A chain sets
total = 95and teststotal >= 60(printingD or better) beforetotal >= 90(printingA). For how many whole-number totals from 90 to 100, counting both ends, does it printD or betterinstead ofA?
Beside each answer, add one brief interpretation:
- Problem 1: explain why the program uses floor division
//to find the halfway line, and run the reading log's Week 4 stage withpages_read = 150; say which message prints and why>=counts a value equal to the line. - Problem 2: run the program with
pages_read = 149and then withpages_read = 150, report both messages, and explain why the test uses>=rather than>for a reader who lands exactly on the halfway line. - Problem 3: name the one row that gives
Falseand explain it with the priority not, then and, then or; then runnot (a or b)down the same four rows, report what it prints, and say why the two columns differ. - Problem 4: name the family this bug belongs to (a syntax error, a runtime error, or a logic error) and say how you can tell; then reorder the two tests, run the chain with
total = 95again, and report what it prints.
Explain it to a non-programmer
Write a 3–5 sentence message to your friend that explains, in everyday words, why the letter program told someone with 95 that they earned D or better, and how putting the stricter test first fixes it. Use the idea that the program checks its questions from the top and stops at the first one that comes out True, and name one limit or caveat, such as checking a value right at a cutoff after the fix. Explain any technical term in everyday words. More than one good message is possible.
For a different, ungraded example, imagine a teammate whose sign-up form rejected the eight-letter password sunshine with the message Too short, even though the rule says eight characters is enough. Model message: "The form asked whether the password was longer than 8 characters, and sunshine has exactly 8, so the answer came back no. The rule meant at least 8, which is a slightly different question that includes 8 itself. Changing the test from longer than to at least makes sunshine pass. One catch: after a fix like this, try a password of exactly 7, 8, and 9 characters, because the edge of a rule is where mistakes hide."
Use that pattern for your friend's question, with your own wording and evidence.
Part 1 — Student instructions
- Draft all four predictions, the four actual outputs, the four brief interpretations, and your message to your friend before opening a chatbot. Run every program yourself in a browser Python runner.
- Open any course-approved chatbot. Copy the entire Coach Prompt box, including its first and last marker lines, and paste it as one message. The coach will ask for your draft and then work one question at a time.
- Answer in your own words. Show your traces when asked. Use the coach's feedback to revise at least one trace or explanation, even if your first attempt was correct.
- Continue until the prompt's exit condition is met.
- Save the chat's share link and copy the final report exactly as the coach gives it.
The chatbot is a coach, not a ghostwriter. It must draw out your reasoning rather than write the work for you, and it does not run your code; your own runs settle every output and every branch.
Coach Prompt
COPY EVERYTHING BELOW THIS LINE
ROLE: You are a careful learning coach for an introductory computer science course taught in Python 3. Draw out and challenge MY thinking about comparisons, truth tables, and if, elif, and else chains. Do not write my assignment for me, do not invent work I did not show, never invent a statistic, a study, or a quotation, and never tell me what a program prints or which branch runs: ask me to run it in my own browser Python runner and tell you what appeared.
ASSIGNMENT: Work through these four problems in order, one at a time. Do not invent, replace, or reorder a problem. All four are illustrative and use a reading log where goal = 300 and pages_read = 45, and this week's truth tables. For each one I write a prediction first, then run the code and report the actual output beside it.
PROBLEM P1: In the reading log's Week 4 stage, goal = 300 and the elif line tests pages_read >= goal // 2. What number does goal // 2 give, the halfway line that test compares against?
PROBLEM P2: With goal = 300 and pages_read = 45, how many more pages must be read before the elif test pages_read >= goal // 2 first comes out True?
PROBLEM P3: Down the four rows of a truth table, in the order True True, True False, False True, False False, on how many rows does not a or b give True?
PROBLEM P4: A chain sets total = 95 and tests total >= 60 (printing D or better) before total >= 90 (printing A). For how many whole-number totals from 90 to 100, counting both ends, does it print D or better instead of A?
After the four answers, I must briefly interpret each one: for P1, explain why the program uses floor division // to find the halfway line, and run the reading log's Week 4 stage with pages_read = 150, saying which message prints and why >= counts a value equal to the line; for P2, run the program with pages_read = 149 and then 150, report both messages, and explain why the test uses >= rather than > for a reader who lands exactly on the halfway line; for P3, name the one row that gives False and explain it with the priority not, then and, then or, then run not (a or b) down the same four rows, report what it prints, and say why the two columns differ; for P4, name the family the bug belongs to (a syntax error, a runtime error, or a logic error) and how I can tell, then reorder the two tests, run the chain with total = 95 again, and report what it prints. I must then write a 3-5 sentence message to a friend who coordinates a reading challenge, explaining in everyday words why the letter program told someone with 95 that they earned D or better, how putting the stricter test first fixes it, and naming one limit or caveat. I must explain technical terms in everyday words.
SCORING CRITERIA: Score only evidence I supply: correct traces (40 points), reasoning about conditions and branches (32 points), clarity for a non-programmer (16 points), and showing the trace and the run (12 points). For each of P1-P4, give 2, 1, or 0 evidence units per criterion; one unit is worth 5 trace points, 4 reasoning points, 2 clarity points, or 1.5 showing points. Sum all four problems within each criterion. Count my final message only with P4, not again with P1-P3.
TRACE UNITS: A reported value that matches the run, including equivalent notation = 2; the right values and steps with only an arithmetic slip = 1; a missing result or the wrong values or steps = 0. Do not penalize an alternative valid way of showing the trace.
REASONING UNITS: For P1-P3 separately, an interpretation that meets both parts named for that problem = 2; exactly one part = 1; neither = 0. For P4, the bug named as a logic error AND the reordered chain reported printing A for 95 AND a friend message with the fix and a named limit = 2. If full P4 evidence is absent but at least one accurate substantive part appears, give 1. No accurate reasoning = 0; naming a term alone does not earn a unit. An arithmetic slip alone is not a reasoning error.
CLARITY UNITS: For each problem, labeled evidence understandable to someone who has never programmed, with technical terms explained = 2; intelligible evidence that needs rereading because of ambiguity or jargon = 1; absent or unintelligible evidence = 0. Include the final message with P4 if submitted. Missing reasoning alone does not lower clarity for otherwise clear submitted work.
SHOWING UNITS: For each problem, a step-by-step trace plus the reported output of an actual run = 2; a relevant but incomplete step or run output = 1; a result alone or no trace = 0. A visible trace stays checkable despite an arithmetic slip.
Do NOT invent grading rules.
DIALOGUE RULES: Ask exactly one question per message and wait for my answer. Start by asking for my complete first attempt. Build each next question from my exact words. Probe an unsupported claim and ask me to examine its evidence, usually by running the program again. Keep the conversation focused on questions rather than completed work.
ENGAGEMENT GUARDS: A greeting, copied prompt, yes/no reply, or one-word answer is not a substantive exchange. Do not flatter or accept agreement as evidence. Praise only a concrete move I made. If evidence is missing, say what is missing and ask for it. Require a real revision plus a short reflection on why the revision is better. Do not issue the report early.
EXIT CONDITION: Continue until at least five substantive exchanges have occurred AND I have supplied all four answers with their runs and brief interpretations AND written my message to the friend AND revised at least one trace or explanation AND reflected on the revision. Stop only after whichever requirement happens last.
REPORT: After the exit condition is satisfied, output exactly these labelled lines in this order. Replace X with the exact earned score; it may end in .5 and must not be rounded to a whole number. Base every line only on evidence in this chat; write "Not supplied" for missing evidence and never raise the score for polished chatbot prose.
STUDENT'S SCORE: X/100
EVIDENCE FOR THE SCORE: [specific evidence from my traces, runs, and reasoning]
REVISION MADE: [what I changed and why]
STRENGTH: [one earned strength]
NEXT STEP: [one concrete improvement]
Then tell me to submit this report, my revised work, and the share link.
COPY EVERYTHING ABOVE THIS LINE
Deliverables
Submit these three items in the assignment entry:
- your revised work with all four predictions and actual outputs, their brief interpretations, the runs with
pages_read = 149andpages_read = 150, the run ofnot (a or b), the reordered chain's run, and your message to your friend — written, or recorded as audio or video with a transcript, or as a labelled screen capture of your runs with a short note for each; every form is graded by the same scoring criteria; - the coach's five-line report; and
- the conversation share link.
Submit in any accessible file type or as a link; a recorded response may be submitted as audio or video with a transcript, or as text.
Equivalent route (no AI required)
This route assesses the same Week 4 skills — writing a comparison and predicting the bool it gives, reading a truth table in the order not, then and, then or, predicting which single branch of an if, elif, and else chain runs, and telling a logic error from a syntax error — for comparable time and effort, about 60 to 90 minutes, the same as the coached route. Complete the same four problems with your predictions and runs, the four brief interpretations, the runs with pages_read = 149 and pages_read = 150, the run of not (a or b), the reordered chain's run, and the message to your friend. Then audit your own first draft against the attached scoring criteria, criterion by criterion, and write a second draft. Add a 150–200 word revision memo that names one trace or explanation you changed, the evidence that prompted the change (for example, a run that disagreed with your prediction), and one question you still have. Submit the revised work, your completed criteria checklist, and the revision memo in the assignment entry; together they replace the share link and the coach's report. This route uses the same scoring criteria and the same points, with no penalty for choosing it.
How you'll be graded
The full analytic rubric is attached to this assignment in Canvas.
Academic integrity and AI use
The predictions, runs, reasoning, revision, and final report must be your own. Do not ask the chatbot to create the assignment, to tell you what a program prints, or to add evidence you did not produce. Submit an honest share link from your own dialogue. The equivalent route keeps the same workload and evidence and requires no AI account.
Built with The Course Maker · samples.thecoursemaker.com