Week 2 — Name It, Divide It, Convert It: Tracing Variables and Types
Assignment 2 of the term — trace short programs that use variables, three kinds of division, a power, and a type conversion, run each one to check, and explain the results 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 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
Your roommate watched you run the reading log and said, "Python can't make up its mind: you divided 255 by 30 three times and got 8.5, then 8, then 15." Your job is to check that claim the way a programmer would: predict each line before you run it, run it in a free browser Python runner, and explain what Python actually did. All four programs are illustrative.
Work these four problems. For each one, write your prediction first, then run the program and write the actual output beside your prediction:
- The reading log has
goal = 300,pages_read = 45, andpages_left = goal - pages_read, and its last line isprint(pages_left / 30). What does that line print? - The same reading log shows that
print(pages_left // 30)prints 8, the number of full 30-page days. What doesprint(pages_left % 30)print? - A lab dish starts with 3 cells, and each cell splits into 2 three times; the program
cells = 3followed byprint(cells * 2 ** 3)counts them. What does it print? - A café app stores a bill as
bill = 18and a tip typed by a customer astip = "4", and its last line isprint(bill + int(tip)). What does that line print?
Beside each answer, add one brief interpretation:
- Problem 1: explain why the output has a decimal point even though both numbers are whole, and say what the number means for the reading log.
- Problem 2: explain why
pages_left // 30gives 8 instead of rounding 8.5 up to 9, and check your output by multiplying back (8 full days times 30, plus the remainder, should rebuild 255). - Problem 3: name the operator Python works out first, and explain why
print((cells * 2) ** 3)prints a different number although both lines run without an error. - Problem 4: first run
print(bill + tip)without the conversion, read the last line of the error message, name the error type, and say whether anything printed; then explain in one sentence whatint(tip)changed.
Explain it to a non-programmer
Write a 3–5 sentence message to your roommate that explains, in everyday words, why dividing 255 by 30 gave three different results and why that is not Python changing its mind. Use the idea that the computer does exactly what you wrote, not what you meant, say which operator answers which question, and name one limit or caveat, such as the fact that floor division throws the leftover away, so you need the remainder to see it. Explain any technical term in everyday words. More than one good message is possible.
For a different, ungraded example, imagine four friends splitting 22 slices of pizza, and a friend who asks why a calculator showed 5.5 slices each when the box ran out after 5 slices each. Model message: "Both numbers are right; they answer different questions. 22 ⁄ 4 = 5.5 is the exact share, but nobody cuts a slice in half at a party, so each friend gets 5 whole slices. 4 × 5 = 20 slices are handed out, and 22 − 20 = 2 slices are left over. The exact share is a fair average, but it cannot tell you how many whole slices are left, so you need the leftover count too."
Use that pattern for your roommate'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 roommate 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.
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 variables, data types, operator precedence, the three kinds of division, and type conversion. 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 line of code prints: 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 programs are illustrative. For each one I write a prediction first, then run the program and report the actual output beside it.
PROBLEM P1: The reading log has goal = 300, pages_read = 45, and pages_left = goal - pages_read, and its last line is print(pages_left / 30). What does that line print?
PROBLEM P2: The same reading log shows that print(pages_left // 30) prints 8, the number of full 30-page days. What does print(pages_left % 30) print?
PROBLEM P3: A lab dish starts with 3 cells, and each cell splits into 2 three times; the program cells = 3 followed by print(cells * 2 ** 3) counts them. What does it print?
PROBLEM P4: A café app stores a bill as bill = 18 and a tip typed by a customer as tip = "4", and its last line is print(bill + int(tip)). What does that line print?
After the four answers, I must briefly interpret each one: for P1, explain why the output has a decimal point even though both numbers are whole, and say what the number means for the reading log; for P2, explain why pages_left // 30 gives 8 instead of rounding 8.5 up to 9, and check my output by multiplying back (8 full days times 30, plus the remainder, should rebuild 255); for P3, name the operator Python works out first, and explain why print((cells * 2) ** 3) prints a different number although both lines run without an error; for P4, first run print(bill + tip) without the conversion, read the last line of the error message, name the error type, and say whether anything printed, then explain in one sentence what int(tip) changed. I must then write a 3-5 sentence message to a roommate who thinks Python cannot make up its mind because dividing 255 by 30 gave 8.5, then 8, then 15, explaining in everyday words which operator answers which question 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 how Python works out values and types (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 and the unconverted error reading only with P4, not again with P1-P3.
TRACE UNITS: A printed value that matches the run, including equivalent notation = 2; the right values and order of operations with only an arithmetic slip = 1; a missing result or the wrong values, operator, or order = 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 unconverted line read from the last line of its error message with the type named and whether anything printed AND the conversion explained AND a roommate message that matches each operator to its question with 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 result = 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 roommate 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 error reading for the unconverted line, and your message to your roommate — 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 2 skills — storing values in variables and tracing them, choosing between true division, floor division, and the remainder, working out a power with the right operator precedence, and converting a value before mixing types — 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 error reading for the unconverted line, and the message to your roommate. 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 line 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