Week 7 Discussion — Print It or Return It? — Traditional alternative (no AI)
Instructors: publish this instead of the adaptive version if you prefer, and unpublish or delete the adaptive one.
Hook
A recipe card is written once and followed for every order, and a calculator hands you a number you can keep using. This week you learned that a function is defined once with def and runs only when called, that arguments bind to parameters by position, and that a function which prints instead of returning hands back None, so print(show(4)) prints 8 and then None.
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 small, repeated task from your own life, major, or workplace, such as converting a recipe, totalling a shift's hours, or turning minutes into whole hours. Design a function for it: give it a name, list its parameters, and argue whether it should return its answer or print it, and what the code that calls it will do with the value. Use this week's ideas (function, parameter, argument, return, None) and say what someone who would design it the other way would argue.
Option B: A function can read a global variable, or it can receive the same value through a parameter, so the reading log could keep its goal of 300 pages at the top level or hand it to pages_left as an argument. Take a position on when reading a global inside a function is reasonable and when the value should be handed in as an argument instead, and say what could go wrong with each choice. Use this week's ideas (local variable, global variable, scope, frame, parameter) and say what someone who weighs convenience differently from you would argue.
There is no single right answer. People who agree on every fact about how Python runs a function still disagree about how a function should hand its work back and which values it should be given, 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 task, write the function's def line with its parameters, say whether it returns or prints and what the calling code does with the value, and explain why; for Option B, name a value a function needs, say whether you would read it as a global or hand it in as an argument, and explain which frame each name would live in.
- Use at least two of this week's terms (function, parameter, argument, return, None, local variable, global variable, scope, frame) 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: wrap their function's call in print and report whether it hands back a value or None, point out a name that would vanish with its frame, 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 bank volunteer converts each delivery from boxes to meals, so I would write def meals(boxes, servings): and have it return boxes times servings, because the code that calls it adds the day's deliveries together, and a printed number cannot be added. If it only printed, the total line would meet None and stop with a TypeError. Someone could argue that a one-off check only needs to print, and that is fair for a quick look, but I would still return the value and print it at the call.
Notice how it names the def line and its parameters, says what the calling code does with the value, names the None 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.
| Criterion | Full credit | Partial credit | No credit |
|---|---|---|---|
| Quality of the initial post (4 pts) | A specific task or program, with its def line or the value in question written out, a clear position with a reason, and a fair statement of another view | A task is present, but the function or value stays vague, or the position is asserted without a reason | Missing, off-topic, or no reasoning about how the function hands back its work or which values it is given |
| Use of course concepts (3 pts) | Uses parameter, argument, return, None, local, and global precisely, with every claim about what a call hands back matching a run | Uses a term loosely, or treats print and return as the same thing | 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