← Back to the Introduction to Computer Science outline The Course Maker
← Introduction to Computer Science outline
Week 5 · Discussion: Traditional alternative (no AI)

Week 5 Discussion — When Should a Loop Stop? — Traditional alternative (no AI)

Introduction to Computer Science Free sample edition
Traditional alternative (no AI), unpublished. In the course this is a separate discussion that ships unpublished beside the adaptive discussion: same objective, no AI. An instructor who prefers it publishes it and unpublishes or deletes the adaptive one, as the note at its top says.

Instructors: publish this instead of the adaptive version if you prefer, and unpublish or delete the adaptive one.

Hook

The reading log in this week's chapter aimed for 300 pages and stopped at 315, because a while loop checks its condition only at the top of each pass. A loop that never moves toward its stop runs forever, and a while True loop stops only when its break is reached, so every loop's stopping point is a decision someone made when they wrote the code.

Your discussion question — choose Option A or Option B; they carry the same weight and the same rubric, and you say which you picked.

Option A: Many programs repeat until something changes: an app that keeps retrying a lost connection, a sign-in page that lets you try again, a machine that keeps filling until a sensor says it is full. Pick one you have used or can imagine and take a position on how its loop should stop: when it is fine for a program to keep trying with while True and a break, and when a loop should give up on its own after a set number of passes. Use this week's ideas (a while loop, its loop condition, a counter, break, and an infinite loop) and say what someone who weighs persistence differently from you would argue.

Option B: The reading log's loop carried its total past the goal, 285 then 315, because the test runs only at the top of each pass. Overshooting a reading goal by 15 pages does no harm, but a loop that adds one more full step past a limit could overfill a tank, overcharge a card, or count one dose too many. Pick a real or imagined loop that steps toward a limit and take a position on when an overshoot is acceptable and when the programmer must change the loop so it can never pass the limit. Use this week's ideas (the test at the top of each pass, a counter or an accumulator, less than versus less than or equal to, and the off-by-one error) and say what someone who values simplicity differently from you would argue.

There is no single right answer. People who agree on every fact about how Python runs a loop still disagree about when a program should keep trying and how close to a limit it may go, because those questions rest on judgment about people and risk as well as on the facts. Pick the option you actually care about, and make your case.

Expectations

Activity format: one initial post followed by two substantive peer replies. Plan on about 45 minutes across the two deadlines; your instructor sets both due dates in Canvas.

Your initial post — by the first due date (early in the module week):

  • Say which option you chose.
  • For Option A, describe the program, say how its loop should stop (a break that is sure to be reached, or a counter that gives up after a set number of passes), and say why; for Option B, describe the loop and its limit, say whether an overshoot is acceptable there, and if not, how you would change the condition.
  • Use at least two of this week's terms (while loop, loop condition, pass, counter, accumulator, off-by-one error, infinite loop, break) correctly.
  • State the strongest case for a view you do not hold, in one or two sentences.
  • Length: roughly 150–250 words if written. You may instead record your post as audio or video (about two minutes) and attach a transcript; both forms are scored by the same rubric.

Your replies — by the second due date (the end of the module week):

  • Reply substantively to at least two classmates.
  • A substantive reply does more than agree: trace their loop one pass further than they did, point out a starting value their rule would mishandle, or make the strongest fair case for the side they did not take. "Nice point!" on its own does not count.

What a strong post looks like:

I chose Option B. Picture an illustrative water tank that a loop fills 30 litres at a time while the level is less than 300 litres, starting from 45, which is the reading log's loop with litres instead of pages. Because the test runs only at the top of each pass, the level goes from 285 to 315, so a 300-litre tank would overflow by 15 litres. For a reading goal that overshoot is harmless, but for a tank I would make the last pass add only what is left. Someone could argue the simpler loop is easier to check, and that is fair, but an overflow is a cost the simple version hides.

Notice how it names the loop, its limit, and the exact values at the top of the last pass, takes a position, and states a fair case for the other side. That is the bar.

Participation rubric

This discussion is worth 10 points. The three criteria below look at your initial post and your peer replies.

How the 10 points of this discussion are earned
Criterion Full credit Partial credit No credit
Quality of the initial post (4 pts) A specific loop with its limit or stopping rule named, a clear position with a reason, and a fair statement of another view A loop is present, but its stopping rule stays vague, or the position is asserted without a reason Missing, off-topic, or no reasoning about how a loop stops
Use of course concepts (3 pts) Uses while loop, loop condition, pass, counter, break, and infinite loop precisely, with the top-of-pass test applied correctly Uses a term loosely, or says the loop checks its condition in the middle of a pass No course terms, or used incorrectly
Engagement with peers (3 pts) Two or more substantive replies that extend or challenge a classmate's reasoning One substantive reply, or replies that only agree No replies, or "I agree" with nothing added

Post early if you can — the best threads happen when people have time to reply before the second due date.

Built with The Course Maker · samples.thecoursemaker.com