Week 7 — Readings & Resources
Your primary reading is Chapter 7 (in this module). Everything below is the optional, go-deeper layer — pick what helps, skip the rest.
How to use this page
This page has 11 items (5 readings and 6 videos). Allow 75–91 minutes for everything. Each group points back to the matching chapter section and class-session segment, so use the full menu when you want more, or take the quick path below.
Every video here has captions: turn them on with the CC button in the player. The chapter covers the same ideas in text.
Pick-one quick path (19–22 min total)
- Python return statement — Bro Code
- Introducing Functions, Python for Beginners 29 of 44 — Microsoft Developer
- Functions — learnpython.org
① Defining a function and handing it values
Chapter 7, Section “Define once, call by name: def runs nothing until you call” · Session 1, Segment 2, “def and the call” · Remember: a def block stores the body under a name, and only a call runs it.
- Introducing Functions, Python for Beginners 29 of 44 — Microsoft Developer — a talk on why copied-and-pasted code belongs in a function, walking through a def line, a parameter, and a function that returns a value the caller stores; at each call, say whether the function prints something or hands a value back. Its time-stamp example imports a library, which comes later. Use it while working through the Week-7 module overview. (video, 10 min) (captions: creator)
- Parameterized Functions, Python for Beginners 31 of 44 — Microsoft Developer — a follow-up on handing values into a function through parameters; in the first two minutes a second parameter is added, so line up each argument with the parameter in the same position. Stop when default values begin, about two and a half minutes in; default values and named arguments go beyond this week. (video, 7 min) (captions: creator)
- Functions — learnpython.org — a one-page lesson with an in-browser exercise; read What are Functions, How do you write functions, and How do you call functions, then try the exercise and predict each line before you run it. This builds on Week 5's work with loops, counters, and accumulators, which you can now place inside a function body. (reading, 5–8 min)
- Writing Functions, Plotting and Programming in Python — Software Carpentry — a carefully tested lesson episode; read the parts on defining a function without running it, matching arguments to parameters, and returning a result, including its example of a call whose result is None. Skip the call that names its arguments and the average example built on a list; both come later. (reading, 10–15 min)
② Return versus print
Chapter 7, Section “Tell return from print: the None a printing function hands back” · Session 1, Segment 4, “return and print” · Remember: print shows a value to you, while return hands it back to the code, and no return means None.
- Python return statement — Bro Code — a four-minute demo of a function that multiplies two numbers and returns the product, which the caller stores and prints; predict the stored value before each print. (video, 4 min) (captions: creator)
- print() vs. return in Python Functions — Coding with Estefania — a side-by-side look at a function that returns its result and one that prints it, ending with a summary of the differences; at each example, ask whether any later code could use the value. (video, 5 min) (captions: automatic)
- Python Functions - Visually Explained — Visually Explained — an animated walk through function syntax, how Python runs a call step by step, the return statement, and the local namespaces each call gets; the namespace part is this week's frame under another name. (video, 14 min) (captions: automatic)
③ Where a function's names live
Chapter 7, Section “Read scope: local names, global names, and the frame” · Session 2, Segment 5, “Scope and the frame” · Remember: a call gets a fresh frame for its local names, and the frame leaves when the call does.
- Python For Beginners - Local and Global Variables Explained — TeachingCS — a classroom-style explainer of global variables, the most common local-variable error, and a local variable example; stop before the last part, which edits a global with a keyword that comes later. (video, 6 min) (captions: automatic)
- Python Scope — W3Schools — a one-screen reference with try-it boxes; read Local Scope and Global Scope, including Naming Variables, and skip the Global Keyword, Nonlocal Keyword, and LEGB sections, which go beyond this week. (reading, 5–8 min)
- The scope program, step by step — Python Tutor — the chapter's scope program loaded in the visualizer; click Next and watch a frame named reset appear with its own level of 0, then vanish while the global level still reads 100. (reading, 5–8 min)
Optional one-stop reference (free online reference)
- Defining Functions, The Python Tutorial section 4.8 — Python Software Foundation — the official tutorial's section on functions, the course's free reference for every language fact; read how def, the body, and return work and how a function without return hands back None, and stop at section 4.9, which covers default and keyword arguments. (reading, 4–6 min)
Heads-up (links rot): these point to outside sites that occasionally move or rename pages. If a link ever fails, tell your instructor and use the reference above in the meantime.
Provenance: Built with The Course Maker · samples.thecoursemaker.com