Week 15 — The Dock That Never Ran Out
Assignment 14 of the term — trace two objects built from one class, find the line that keeps a count from changing, choose between a method that returns and one that prints, 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 7, where a function with no return handed back None, and on Week 9, where a method such as append changed one particular list. 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 campus bike-share wrote a class to track two docks, then rented three bikes from the north dock and four from the south dock:
class BikeDock:
def __init__(self, bikes):
self.bikes = bikes
def rent(self):
if self.bikes > 0:
bikes = self.bikes - 1
return True
return False
def refill(self):
self.bikes = self.bikes + 1
north = BikeDock(9)
south = BikeDock(5)
north.rent()
north.rent()
north.rent()
south.rent()
south.rent()
south.rent()
south.rent()
print(north.bikes, south.bikes)
It printed the same counts the docks started with. Your friend says, "My rent method runs, it even hands back True, but the count never goes down." Your job is to check what Python really did, the way a programmer would: predict each output before you run it, run it in a free browser Python runner, and explain what happened. All four problems are illustrative; Problem 1 uses this week's reading log, and Problems 2 to 4 use the friend's docks, repaired so that rent stores the new count on self, with two more methods added:
class BikeDock:
def __init__(self, bikes):
self.bikes = bikes
def rent(self):
if self.bikes > 0:
self.bikes = self.bikes - 1
return True
return False
def refill(self):
self.bikes = self.bikes + 1
def available(self):
return self.bikes
def report(self):
print("bikes left:", self.bikes)
Work these four problems. For each one, write your prediction first, then run the code and write the actual output beside your prediction:
- The reading log's Week 15 class is built as
mine = ReadingLog(300), thenmine.add_day(45),mine.add_day(30), andmine.add_day(25)run, and the program printsmine.pages_left(). What does it print? - The repaired dock is built as
north = BikeDock(9),north.rent()runs three times, and the program printsnorth.bikes. What does it print? - A second repaired dock is built as
south = BikeDock(5),south.rent()runs four times,south.refill()runs once, and the program printssouth.bikes. What does it print? - After the same calls as Problems 2 and 3, the program runs
print(north.available() + south.available()). What does it print?
Beside each answer, add one brief interpretation:
- Problem 1: name the two attributes
__init__stores onself, and run a second log,yours = ReadingLog(150), built besidemine; report whatprint(yours.pages_left())prints aftermine's three days, and explain whyyoursis unaffected. - Problem 2: run your friend's original version for the north dock alone, report what
print(north.bikes)prints, and name the line inrentthat is missingself. - Problem 3: add
print(north.bikes, south.bikes)after both docks' calls, report what it prints, and explain why the rentals at one dock never change the other. - Problem 4: run
print(north.report() + south.report())in place of the last line, report what prints and which exception type ends the run, and then choose: to total the bikes, would you read each dock'sbikesattribute, call the returning methodavailable, or call the printing methodreport? Say why your choice fits best and why one other choice fits less well.
Explain it to a non-programmer
Write a 3–5 sentence message to your friend that explains, in everyday words, why the count never went down and how one change fixes it. Use the idea that each dock keeps its own count, and that a line inside a method must say it is changing this dock's count or the new number is thrown away when the method ends, and name one limit or caveat, such as that a program can run with no error message and still print the wrong number. Explain any technical term in everyday words. More than one good message is possible.
For a different, ungraded example, imagine a café whose loyalty-card program never adds a stamp. Model message: "Your card program works out the new number of stamps every time, but it writes that number on scrap paper instead of on the card, so the card itself never changes. Python did exactly what the instruction said, which is why there was no error message, only a card that always shows zero stamps. If the line says to update this card's stamps, the count goes up with every visit. One catch: a program can run without complaining and still be wrong, so it is worth testing it with a visit or two before anyone relies on it."
Use that pattern for your friend's question, with your own wording and evidence.
After this assignment
This is the last assignment of the course. Next comes Week 16, the finals week, which carries the cumulative final exam. The final's study guide, its exam-prep tutorial, and the Final Practice Exam help you prepare. The choose-the-method step in Problem 4 is the same move the final asks of you: read a program, pick the course idea that fits, and say why another one fits less well.
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.
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 classes, objects, attributes stored on self, methods, and why each object keeps its own count. 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 are illustrative. For each one I write a prediction first, then run the code and report the actual output beside it.
PROBLEM P1: The reading log's Week 15 class is built with a goal of 300 pages, then 45, 30, and 25 pages are added on three days, and the pages left are printed. What does the program print?
PROBLEM P2: The repaired bike-share dock is built with 9 bikes, three bikes are rented from it, and its count of bikes is printed. What does the program print?
PROBLEM P3: A second repaired dock is built with 5 bikes, four bikes are rented from it, one bike is brought back to it, and its count of bikes is printed. What does the program print?
PROBLEM P4: The two repaired docks from P2 and P3, after the same rentals and the one bike brought back, are totaled by adding what each dock's returning method hands back, and the total is printed. What does the program print?
After the four answers, I must briefly interpret each one: for P1, name the two attributes the setup method stores on self and run a second log built with a goal of 150 to show it is unaffected; for P2, run my friend's original dock, say what it prints, and name the line that is missing self; for P3, print both docks' counts and say why the rentals at one dock never change the other; for P4, run the version that adds two printing report calls, name the exception type, choose between reading each dock's attribute, calling the returning method, and calling the printing method, and say why my choice fits best and another fits less well. I must then write a 3-5 sentence message to my friend explaining in everyday words why the count never went down, how one change 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 classes and objects (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 method calls on the right object with only an arithmetic or counting slip = 1; a missing value or the wrong object or calls = 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 exception type of the printing version AND the choice of the returning method with a reason AND a comparison with reading the attribute 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. A counting 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 of each method call and the object it changes plus the reported output of an actual run = 2; a relevant but incomplete step or run output = 1; a final value alone or no trace = 0. A visible trace stays checkable despite a counting 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 or stepping through it in Python Tutor. 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 my 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 of the second reading log, your friend's original dock, both docks' counts, and the printing version, 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 15 skills — tracing objects built from one class, finding a value that never reached self, keeping a method that returns apart from one that prints, and choosing the right tool for a job — 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 of the second reading log, your friend's original dock, both docks' counts, and the printing version, 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