Back to the Introduction to Computer Science outline The Course Maker
Introduction to Computer Science outline
Week 6 · Readings & resources

Week 6 — Readings & Resources · Loops II: `for`, `range` & Nested Loops

Introduction to Computer Science · CSCI 1101 Fall 2026 · Prof. Okafor Fictional sample

Course: Introduction to Computer Science — CS1 / Programming Fundamentals in Python (CSCI 1101) · Silver Oak University (fictional sample) · Prof. Okafor
Objective covered: Objective 4 — Write and trace for loops, range() (with its exclusive stop and step), iterating over a string, accumulating, and nested loops.


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 load is light: read one or two short pages, then go run loops. The fastest way to learn for and range is to type a range and list itprint(list(range(1, 5))) — and watch what comes out.

Order that matches the lecture: ① the for loop & iteration → ② range() (start / stop / exclusive stop / step) → ③ nested loops → ④ run & visualize.

A habit to keep this week: never trust the contents of a range you didn't list. Before you believe a page (or a chatbot) about what range(1, 5) contains, wrap it in list(...) and run it.


① The for Loop & Iteration

Maps to Lecture Segments 2–3. A for loop repeats a block once for each item in a sequence — a string's characters, or the numbers from range().

Read & do — "Python for Loop (With Examples)" (Programiz)
🔗 https://www.programiz.com/python-programming/for-loop
Why it's assigned: the cleanest walk-through of the for loop in this course's order — iterating a list and a string, then for with range(), then nested for loops at the bottom (with the exact output shown). Read it, then retype its examples in the runner and confirm they print what the page says.
⏱ ~10 min

Interactive — "Python For Loops" (W3Schools)
🔗 https://www.w3schools.com/python/python_for_loops.asp
Why it earns the click: a friendly, click-through page with a green "Try it Yourself" button on every example — loop over a string, loop with range(), and the range(2, 6) / range(2, 30, 3) step examples, all runnable right on the page. Do the "Looping Through a String," "The range() Function," and "Nested Loops" sections.
⏱ ~10 min


range() — start, stop (exclusive!), step

Maps to Lecture Segment 3. range(stop) is 0 … stop-1; range(start, stop) starts where you say; range(start, stop, step) strides. The stop value is always excluded — the #1 off-by-one source.

Read — "The range() Function" (official Python Tutorial, §4.3)
🔗 https://docs.python.org/3/tutorial/controlflow.html
Why it's assigned: the source of truth. Scroll to §4.3 "The range() Function" — it states plainly that "the given end point is never part of the generated sequence," and shows range(5)0,1,2,3,4, list(range(5, 10))[5, 6, 7, 8, 9], and list(range(0, 10, 3))[0, 3, 6, 9]. Read §4.2 (for) and §4.3 (range); the rest of the chapter is later weeks. (The whole tutorial index is your reference all term: 🔗 https://docs.python.org/3/tutorial/index.html.)
⏱ ~8 min

Reference — "Python range() Function" (W3Schools)
🔗 https://www.w3schools.com/python/ref_func_range.asp
Why it earns the click: a one-page reference for the range(start, stop, step) parameters with a runnable example — handy when you just need to check what a particular call produces.
⏱ ~3 min


③ Nested Loops · and ④ Run & Visualize

Maps to Lecture Segments 5–6. A loop inside a loop: the inner loop runs fully for every step of the outer loop. Build a grid or a small times-table — then watch it run.

See your nested loop run, step by step — Python Tutor
🔗 https://pythontutor.com/
Why it earns the click: the single best tool for understanding a nested loop. Paste a 3×3 grid or a small multiplication-table loop, click Visualize Execution, and step forward — you'll literally see the inner loop cycle through completely before the outer loop advances. Do this with at least one nested loop this week.
⏱ ~5 min

Run Python in your browser — a free online editor (no install)
🔗 https://www.online-python.com/
Why it earns the click: where you'll write and run every loop this week. Type a loop, press Run, read the output — and print(list(range(...))) whenever a range's contents are in doubt. (A second option if you ever want it: 🔗 https://www.programiz.com/python-programming/online-compiler — same idea.)
⏱ 2 min to open and run a for loop


Optional one-stop references (free online)


Pick-one quick path (≈15 min total)

In a hurry? Do exactly these two and you'll be ready for the quiz:
1. Read Programiz "Python for Loop" (group ①) through the range() and nested-loops sections.
2. Open online-python.com and run print(list(range(1, 5))), then print(list(range(0, 10, 2))), then a 3×3 star grid — and see for yourself that range(1, 5) is 1, 2, 3, 4 (no 5) (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/controlflow.html, §4.3) or W3Schools (w3schools.com/python) in the meantime.

~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com