Week 7 — Readings & Resources · Functions
Course: Introduction to Computer Science — CS1 / Programming Fundamentals in Python (CSCI 1101) · Silver Oak University (fictional sample) · Prof. Okafor
Objective covered: Objective 5 — Define functions with def; parameters & arguments; return; local vs. global scope.
How to use this page
Everything here is a link to an external resource — open it in your browser. Nothing needs to be downloaded or installed; the Python environments below run in the browser.
This week's idea — the function — is best learned by writing one, calling it, and watching what comes back. So as you read, keep a Python tab open and run every example, especially the ones that print None. The single habit that matters most this week: don't trust what a page (or a chatbot) says a function returns — call it and read what Python actually does.
Order that matches the lecture: ① define & call a function (
def, parameters/arguments) → ②returna value and use it (andreturnvs.Nonecase) → ③ local vs. global scope.Midterm heads-up: functions are the last topic on the Week 8 Midterm (cumulative, Weeks 1–7). A solid pass through these links now is also midterm prep.
① Define & Call a Function — def, Parameters & Arguments
Maps to Lecture Segments 2–3. A function is a named, reusable block: define it once with
def, then call it with arguments that fill its parameters.
Read & do — "Python Functions" (Programiz)
🔗 https://www.programiz.com/python-programming/function
Why it's assigned: the cleanest walk-through of the whole idea — defining a function with def, calling it, the difference between parameters (in the definition) and arguments (in the call), and the return statement — with short runnable examples. Read it, then type def greet(name): print("Hello,", name) into the editor and call it with two different names.
⏱ ~12 min
Read — "Defining Functions" (official Python Tutorial, §4.8)
🔗 https://docs.python.org/3/tutorial/controlflow.html
Why it's assigned: the source of truth. Section 4.8 Defining Functions explains def, parameters, and — crucially for this week — states plainly that "even functions without a return statement do return a value… called None," and shows print(fib(0)) displaying None. That is exactly our return-vs-print lesson, from the people who make Python. Read §4.8 (you can stop before §4.9's advanced argument forms, which are beyond CS1 this week).
⏱ ~10 min
② return a Value · and return vs. print (the None case)
Maps to Lecture Segments 3–4.
returnhands a value back so the rest of your program can use it.returnreturnsNone— soprint(f())showsNone.
Run it yourself — a free online Python editor (no install)
🔗 https://www.online-python.com/
Why it earns the click: this week is about behavior you must see. Paste def greet(): print("Hi there!") then print(greet()) and run it — watch it print Hi there! and then None. (A second option, if you ever want it: 🔗 https://www.programiz.com/python-programming/online-compiler — same idea.)
⏱ 2 min to run the None demo
Interactive — "Python Functions" (W3Schools)
🔗 https://www.w3schools.com/python/
Why it earns the click: a friendly, click-through introduction to creating and calling functions, passing arguments, and the return statement, with a green "Try it Yourself" button on every example so you run code right on the page. Use the left menu to open Python Functions (and Python Scope, which pairs with group ③).
⏱ ~10 min
③ Local vs. Global Scope
Maps to Lecture Segment 5. A variable created inside a function is local — invisible outside, and reassigning a name inside doesn't change the outer (global) variable.
Read & do — "Python Variable Scope" (Programiz)
🔗 https://www.programiz.com/python-programming/global-local-nonlocal-variables
Why it's assigned: exactly our scope lesson with runnable examples — a local variable used outside its function raises NameError: name '...' is not defined, and a global is readable inside. (It also shows the nonlocal keyword for nested functions; that's beyond this week — read the Local Variables and Global Variables sections and you've got what Quiz 7 needs.) Type the local-variable example in and run it to see the NameError.
⏱ ~8 min
Reference — the full Python Tutorial index
🔗 https://docs.python.org/3/tutorial/index.html
Why it earns the click: your reference all term. Functions live in §4 (More Control Flow Tools); keep this handy as the midterm pulls Weeks 1–7 together.
⏱ as needed
Optional one-stop references (free online)
- Programiz — "Getting Started with Python" (full Python tutorial index). A free, well-organized tutorial you can return to all term; the Python Functions section covers everything in this week in order.
🔗 https://www.programiz.com/python-programming - See your code run, step by step — Python Tutor. The best tool in this course for seeing scope: paste a function call, click Visualize Execution, and watch a new frame appear with the local variables and vanish when the function returns.
🔗 https://pythontutor.com/
Pick-one quick path (≈15 min total)
In a hurry? Do exactly these two and you'll be ready for the quiz:
1. Read "Python Functions" on Programiz (group ①), then in online-python.com define def area(w, h): return w * h and run print(area(3, 4)) — confirm it's 12.
2. Run the None demo: def greet(): print("Hi there!") then print(greet()) — see it print Hi there! and None, and read §4.8 of the official tutorial on why (groups ②–③).
Heads-up (links rot): these point to outside sites that occasionally move or rename pages. If a link ever fails, tell Prof. Okafor and use the official Python Tutorial (docs.python.org/3/tutorial) or W3Schools (w3schools.com/python) in the meantime.
~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com