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

Week 9 Discussion — Change It in Place, or Make a Copy? — 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

A shared online document has one link, so a friend's edit shows up for you too; a downloaded copy keeps your version safe but drifts out of date. This week you learned that a list can change in place, and that after b = a and then b.append(4), the list a prints [1, 2, 3, 4], because the two names share one list.

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: Pick a list from your own life, major, or workplace that a program might keep, such as a team roster, a queue of orders, a playlist, or a log of readings. Argue whether the program should change that list in place (with methods such as append, remove, and sort) or build a new list each time something changes (with a slice or sorted()), and say what could go wrong with your choice. Use this week's ideas (in place, copy, sort versus sorted(), and what each method hands back) and say what someone who would make the other choice would argue.

Option B: An alias lets two names see one list: a change made through either name shows up through the other. Take a position on when sharing one list under two names is exactly what a program needs, such as several parts of an app updating one to-do list, and when it is a trap waiting to happen, such as a backup that is not really a backup. Use this week's ideas (alias, copy, is versus ==, and changing a list in place) and say what someone who weighs convenience and safety differently from you would argue.

There is no single right answer. People who agree on every fact about how Python stores a list still disagree about when to share one and when to copy it, because those questions rest on judgment about the program 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, name the list, name one change the program makes to it, say whether you would make that change in place or build a new list, and say what the method you chose hands back; for Option B, name a situation where two names share one list, say whether that sharing helps or hurts there, and say how a full slice would change the picture.
  • Use at least two of this week's terms (in place, alias, copy, sort, sorted(), is) 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: run the classmate's example and report what each name holds after the change, point out a method whose return value they misread, 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 A. A food pantry keeps its shelf as a list, shelf = ["rice", "beans", "corn"], in the order donations arrived. When a volunteer wants the shelf in alphabetical order, I would print sorted(shelf), which hands back a new list, ['beans', 'corn', 'rice'], and leaves shelf in arrival order. Writing shelf = shelf.sort() would be the risk, because sort hands back None and shelf would then hold None. Someone could argue that sorting in place is simpler when nobody needs the arrival order, and that is fair, but I would want to know who else is holding the same list first.

Notice how it names the exact list, says what each method hands back, names the risk, 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 list and a specific change, a clear position with a reason, and a fair statement of another view A list is present, but the change stays vague, or the position is asserted without a reason Missing, off-topic, or no reasoning about in-place change, aliases, or copies
Use of course concepts (3 pts) Uses in place, alias, copy, sort, and sorted() precisely, with every method's return value stated correctly Uses a term loosely, or calls b = a a copy 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