Week 6 — Assignment (Adaptive Learning) · "Loops that Count & Build"
Course: Introduction to Computer Science — CS1 / Programming Fundamentals in Python (CSCI 1101) · Silver Oak University (fictional sample) · Prof. Okafor
Objective assessed: Objective 4 (the for loop; range() with its exclusive stop & step; accumulating; nested loops) · SLO A (write & run a correct loop) · SLO B (trace a loop / nested loop; find & fix an off-by-one)
Worth 100 points · Assignments group = 15% of the grade
Format: adaptive learning — you work the problems with your own AI coach, which grades each answer against the rubric, helps you fix what's off, and lets you retry a fresh version to raise your score. You submit the AI's self-scored report (plus your chat link).
Assignment 6 of the term — every instructional week carries one graded assignment (alongside that week's quiz, discussion, and Coding Lab).
Keep a Python tab open (online-python.com): you'll actually write and run loops, and the habit of this course is to confirm output by running it — and toprint(list(range(...)))to see exactly what a range holds.
Part 1 — Student Instructions (read this first)
What this is. An AI coach gives you four problems one at a time — you'll write loops, predict range() outputs, trace a nested loop, and fix an off-by-one bug. The coach scores each against the rubric, tells you exactly what to fix, and teaches you through it. Want a higher score? Ask for a fresh version of that problem and try again — your best attempt counts.
How to run it (about 30–40 minutes):
1. Open any approved AI chatbot — Gemini, Claude, or ChatGPT (free versions are fine).
2. Copy everything in the box below and paste it as one single message.
3. Work each problem. Wrong answers cost nothing here — they're how you learn before the score is set. Run your code (and list your ranges) to check it.
What to submit. When the coach gives you the report — its first line is STUDENT'S SCORE: X/100 — copy the whole report and your conversation's share link, and submit both in Canvas for this assignment by Sunday, Oct 11.
Integrity note. Do your own thinking; the coach is there to help and to grade. Submitting a report you didn't actually earn (e.g., a fabricated chat) is an integrity violation. (This is an adaptive-learning activity — you complete it with an approved chatbot, per the course AI policy.)
Part 2 — The Coach Prompt (copy everything in the box)
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ COPY EVERYTHING BELOW THIS LINE ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
You are my assignment coach and grader for Week 6 of Introduction to Computer Science (CSCI 1101) at Silver Oak University. You will give me the problems below ONE AT A TIME, let me solve each, grade my answer against the rubric, show me how to improve, and let me retry a fresh version to raise my score. You grade ONLY against the answer key and rubric below — never invent problems, answers, or scores. Total possible: 100 points across four problems. Every expected output below was produced by actually running the code in Python; treat it as ground truth, and when I'm unsure, tell me to run my code (and to print(list(range(...))) to check a range). Keep to this week's tools — for, range, strings, arithmetic, print(..., end=...), accumulators (no lists/enumerate/break/continue/functions).
THE PROBLEMS — for you (the coach) only. Never show me this list, the answers, the rubrics, or the fresh variants. Deliver one problem at a time, exactly as written.
──────────── PROBLEM 1 (25 points) — Write a counting loop ────────────
SHOW ME: "Write a Python program that uses a for loop with range() to print the numbers 1 through 5, each on its own line. (Careful: remember the stop value is excluded.)"
VETTED ANSWER:
for i in range(1, 6):
print(i)
which prints, on five lines: 1, 2, 3, 4, 5. The stop must be 6 so that 5 is included; range(1, 5) would wrongly stop at 4.
ACCEPT any for/range loop that prints 1 through 5 on separate lines (a different loop variable name is fine; range(1, 6) is the key bound).
RUBRIC: 25 — a working for loop over range(1, 6) (or equivalent) printing 1–5 (full). Partial: prints 1–4 because they used range(1, 5) = 15 (the off-by-one); starts at 0 (range(6)) = 15; right idea but a small syntax error they can fix = 18.
FRESH VARIANT: "Use a for loop to print the numbers 1 through 7, each on its own line." Answer: for i in range(1, 8): print(i) → 1..7. Same rubric (stop must be 8).
──────────── PROBLEM 2 (25 points) — Accumulate or build a pattern ────────────
SHOW ME: "Write a program that uses a for loop with range() to add up all the whole numbers from 1 to 10 and print the total. (Don't just type the answer — let the loop compute it.)"
VETTED ANSWER:
total = 0
for i in range(1, 11):
total += i
print(total)
which prints 55. The stop is 11 so 10 is included; print(total) is OUTSIDE the loop so it prints once. (total = total + i is fine.)
ACCEPT any for/range accumulator that sums 1..10 and prints 55. If they used range(1, 10) they get 45 (missed the 10) — that's the off-by-one, partial credit.
RUBRIC: 25 — correct accumulator over range(1, 11) printing 55, with print outside the loop (full). Partial: prints 45 (used range(1, 10)) = 15; prints total inside the loop (many lines) but logic right = 18; print(55) typed without a loop = 8.
FRESH VARIANT: "Use a for loop with range() to add up the numbers from 1 to 6 and print the total." Answer: total=0 / for i in range(1,7): total+=i / print(total) → 21. Same rubric.
(If I'd rather build a PATTERN than a sum, you may instead accept this equivalent task at the same points: "print a left-aligned triangle of stars 4 rows tall" → for r in range(1, 5): print("*" * r) → * / ** / *** / ****. Grade on a working for/range loop producing the 4-row triangle.)
──────────── PROBLEM 3 (25 points) — Predict several range() outputs ────────────
SHOW ME: "Predict the exact values each of these produces. Write them out. Then check by running print(list(...)) for each. (a) range(4) (b) range(2, 7) (c) range(1, 10, 3) (d) range(6, 1, -1)"
VETTED ANSWER (run-verified):
(a) range(4) → 0 1 2 3 (0-based, stops before 4)
(b) range(2, 7) → 2 3 4 5 6 (stops before 7)
(c) range(1, 10, 3) → 1 4 7 (step 3 from 1: 1, 4, 7; next would be 10, excluded)
(d) range(6, 1, -1) → 6 5 4 3 2 (counts down from 6, stops before 1, so 2 is the last — NOT 1)
RUBRIC: 25 — about 6 points each, four parts. Award per part for the correct sequence. Part (d) is the tricky one (the down-count stops before 1, so it ends at 2, not 1) — common wrong answers are 6 5 4 3 or 6 5 4 3 2 1; give the part only for 6 5 4 3 2.
FRESH VARIANT: "(a) range(3) (b) range(5, 9) (c) range(0, 20, 5) (d) range(4, 0, -1)." Answers: (a) 0 1 2; (b) 5 6 7 8; (c) 0 5 10 15; (d) 4 3 2 1. Same per-part rubric.
──────────── PROBLEM 4 (25 points) — Trace a nested loop AND fix an off-by-one ────────────
SHOW ME (two parts): "Part A — trace this nested loop: tell me its EXACT output and how many lines it prints.
for i in range(1, 4):
for j in range(1, 4):
print(i * j, end=' ')
print()
Part B — this program is supposed to add up 1 through 10 and print 55, but it prints the wrong number. Find the bug and give the fix.
total = 0
for n in range(1, 10):
total += n
print(total)"
VETTED ANSWER:
Part A — output is three lines: 1 2 3 / 2 4 6 / 3 6 9 (a 3×3 multiplication table; outer i = row, inner j = column, each cell ij). 3 lines (the print() is under the OUTER loop, ending each row); 9 cells total.
Part B — it prints 45, not 55, because range(1, 10) stops at 9 and misses the 10* (the exclusive-stop off-by-one). The fix is range(1, 11), which prints 55.
RUBRIC: Part A 13 — correct output AND line count (3) (7 for the right output, 6 for "3 lines"). Part B 12 — identifies the off-by-one (the 10 is missed because the stop is exclusive) AND gives range(1, 11) (6 for the cause, 6 for the fix).
FRESH VARIANT: Part A — trace for i in range(2): for j in range(4): print(i, j) → 8 lines: 0 0,0 1,0 2,0 3,1 0,1 1,1 2,1 3 (here print is in the INNER loop, so 2×4 = 8 lines). Part B — this is meant to print a 3×3 block of stars on 3 lines but prints 9 lines: for r in range(3): for c in range(3): print("*") — the bug is the print("*") is in the inner loop and makes a newline each time; fix: print("*", end="") in the inner loop and a print() under the outer loop → ***/***/***. Same rubric split.
HOW TO RUN IT (with me, the student):
- Greet me in 1–2 sentences, ask my FIRST NAME, then give Problem 1 exactly as written. (NAME FALLBACK: if I answer without giving my name, keep going, but ask before the final report.)
- ONE problem at a time. Never show the whole set, the answers, the rubrics, or the variants.
- AFTER I ANSWER each problem:
• Grade my answer against that problem's rubric and state the score plainly ("That earns 20 of 25"). Judge MEANING, not wording (e.g., "1 2 3 4 5" and "[1,2,3,4,5]" both count). For the code-writing problems, if my code would error or be off by one, tell me to RUN it (or list() the range) and read what happens, then fix.
• Say specifically what I got right, then TEACH the gap — explain the correct reasoning and show the corrected/working code so I actually learn (full feedback is the point of this assignment).
• OFFER A RE-ATTEMPT: "Want to raise your score? I'll give you a similar problem." If I say yes, deliver the FRESH VARIANT (not the same problem), grade it, and set this problem's score to my BEST attempt (capped at full marks). I can retry as many times as I want.
• Move on when I'm satisfied.
- If I ask about the material, answer briefly, then return to the current problem. If I go off-topic, one friendly sentence, then — IN THE SAME MESSAGE — back to the problem.
- Until the final report, every message ends with a problem, a question, or a clear next step.
- Score HONESTLY against the rubric — don't inflate to be nice, and don't lowball; a wrong answer scores low, a strong answer earns full marks. Grade only against the vetted key above. The exclusive-stop off-by-one is the theme — reward catching it.
COMPLETION + REPORT. After I've finished all four problems (and any re-attempts), produce the report in EXACTLY this format — the FIRST LINE is my score:
STUDENT'S SCORE: X/100
WEEK 6 ASSIGNMENT — Loops that Count & Build
Student: [name] | Date: ___
Problem 1 (Counting loop): a/25 — [one line]
Problem 2 (Accumulate / pattern): b/25 — [one line]
Problem 3 (Predict range outputs): c/25 — [one line]
Problem 4 (Trace nested + fix off-by-one): d/25 — [one line]
Strongest skill: ___
Worth another look: ___
(The four problem scores must add up to the number on line 1.) Then say, verbatim: "Copy this entire report AND your share link to this chat, and submit both in Canvas for this assignment." End with one genuine sentence of encouragement.
GETTING STARTED
Begin now: greet me, ask my first name, and give me Problem 1.
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ COPY EVERYTHING ABOVE THIS LINE ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Instructor grading note (Prof. Okafor)
- Record the
STUDENT'S SCORE: X/100from line 1 of the submitted report into the Assignments group. - Spot-check a sample of chat share links against the reported scores; the embedded vetted key (with run-verified outputs: 1–5,
55, the fourrangesequences incl.6 5 4 3 2, the 3×3 table, and the45→55fix) means the coach grades the same way for every student and every chatbot, so checks are quick. - The answer key + rubric live inside the student prompt (embed-don't-trust), so the score is consistent across Gemini / Claude / ChatGPT. Known weak point (H5/H7): an AI-self-scored grade submitted by share link is gameable; this is acceptable here as one assignment among many, but for high-stakes use pair it with an in-class or proctored check.
Canvas placement block
canvas_object = Assignment
title = "Week 6 Assignment — Loops that Count & Build (adaptive)"
assignment_group = "Assignments"
points_possible = 100
grading_type = points
assignment_type = adaptive
submission_types = [online_text_entry, online_url] # paste the report (score on line 1) + the chat share link
due_offset_days = 6
published = true
provenance = "~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com"
Traditional variant — for comparison. This sample course is configured adaptive learning, so its actual Week-6 assignment is the AI-coached, self-scored version in
I-assignment-and-rubric-week-06.md. This file shows the same Week-6 skills built the traditional way — the student writes the programs and submits them, and the instructor grades against the rubric — so you can see both formats side by side. (Choosingassignment_type = traditionalat course setup generates this style instead.)
Course: Introduction to Computer Science — CS1 / Programming Fundamentals in Python (CSCI 1101) · Silver Oak University (fictional sample) · Prof. Okafor
Objective assessed: Objective 4 (the for loop; range() with its exclusive stop & step; accumulating; nested loops) · SLO A (write & run a correct loop) · SLO B (trace a loop / nested loop; find & fix an off-by-one)
Worth 100 points · Assignments group = 15% of the grade
The Assignment
This week is about repeating with for and range(), and nesting loops to build grids. In four short parts you'll write a counting loop, accumulate (or build a pattern), predict range() outputs, and trace-and-fix a nested loop. Write and run your code in a free online Python editor (online-python.com), then submit your code and a copy of what it printed (a screenshot of the output, or pasted text) as a document upload or text entry in Canvas. You'll be graded on the rubric below — read it before you start. When in doubt about a range, print(list(range(...))) and see exactly what it holds.
Part 1 — Write a counting loop (25 pts). Use a for loop with range() to print the numbers 1 through 5, each on its own line. (Careful: the stop value is excluded — so to include 5, your stop must be 6.) Submit the code and its output.
Part 2 — Accumulate a total (25 pts). Use a for loop with range() to add up all the whole numbers from 1 to 10 and print the total — let the loop compute it (don't type 55). Make sure print is outside the loop so it prints once. Submit the code and its output. (Alternative, same credit: instead of a sum, print a left-aligned triangle of stars 4 rows tall with a for loop — *, then **, then ***, then ****.)
Part 3 — Predict several range() outputs (25 pts). For each call, write the exact sequence of values it produces, then check by running print(list(...)):
(a) range(4) (b) range(2, 7) (c) range(1, 10, 3) (d) range(6, 1, -1)
Part 4 — Trace a nested loop and fix a bug (25 pts).
(a) Trace this nested loop — give its exact output and how many lines it prints:
for i in range(1, 4):
for j in range(1, 4):
print(i * j, end=' ')
print()
(b) This program is supposed to add 1 through 10 and print 55, but it prints the wrong number. Name the bug and give the corrected program:
total = 0
for n in range(1, 10):
total += n
print(total)
Integrity & AI note. This is your own work, submitted for grading. You may use an approved chatbot (Gemini, Claude, or ChatGPT) to help you think — but submitting AI-generated answers as your own is not allowed; if AI helped you think, add a one-line note of which tool and how. Always run your code before submitting — the output is the proof it works. (Note: this is the traditional format. In this course's actual adaptive assignment, you work the problems with the chatbot and submit its self-scored report — see I-assignment-and-rubric-week-06.md.)
Rubric — 100 points
| Criterion (part) | Full credit | Partial | Little/none |
|---|---|---|---|
| Part 1 — Counting loop (25) | for i in range(1, 6): print(i) (or equiv.) prints 1–5 on separate lines (25) |
Prints 1–4 (range(1, 5), the off-by-one) or 0–5 (range(6)) but loop is sound (15–18) |
No working loop / wrong output (0–8) |
| Part 2 — Accumulate / pattern (25) | Accumulator over range(1, 11) prints 55, print outside loop (or 4-row triangle) (25) |
Prints 45 (range(1, 10)) (15); prints inside loop but logic right (18); print(55) typed without a loop (8) |
Missing or non-working (0–6) |
Part 3 — Predict range() (25) |
All four correct: 0 1 2 3 / 2 3 4 5 6 / 1 4 7 / 6 5 4 3 2 (~6 each) (25) |
Three of four; (d) is the common miss (down-count stops before 1, ends at 2) (12–19) | One or none correct (0–8) |
| Part 4 — Trace nested + fix (25) | (a) output 1 2 3 / 2 4 6 / 3 6 9 and 3 lines; (b) names the exclusive-stop off-by-one + fix range(1, 11) (25) |
One part right, or right ideas with a slip (10–18) | Neither part correct (0–8) |
Levels describe observable differences so grading stays fast and consistent. (This same rubric is what the adaptive variant embeds for the AI to grade against.)
Instructor answer key — REMOVE BEFORE PUBLISHING TO STUDENTS
Execution gate: PASS — every program and output below was produced by running the code in Python.
- Part 1: a
for/rangeloop with the stop set to 6 so 5 is included:
python for i in range(1, 6): print(i)
Output (run-verified):
1 2 3 4 5
range(1, 5)would wrongly stop at4(the off-by-one);range(6)would start at0. - Part 2: an accumulator with the stop set to 11 and
printoutside the loop:
python total = 0 for i in range(1, 11): total += i print(total)
Output (run-verified):55. (range(1, 10)would print45, missing the 10.) The triangle alternative:
python for r in range(1, 5): print("*" * r)
Output (run-verified):
```
*
**
- **Part 3 (run-verified, each via `print(list(range(...)))`):**
- (a) `range(4)` → `0 1 2 3`
- (b) `range(2, 7)` → `2 3 4 5 6`
- (c) `range(1, 10, 3)` → `1 4 7`
- (d) `range(6, 1, -1)` → `6 5 4 3 2` *(counts down, stops **before** 1 — so it ends at **2**, not 1. This is the tricky one.)*
- **Part 4:**
- (a) Output (run-verified) is **3 lines** (the row-ending `print()` is under the **outer** loop):
1 2 3
2 4 6
3 6 9
Outer `i` is the row (1, 2, 3), inner `j` is the column (1, 2, 3), each cell prints `i * j`; 9 cells, 3 rows.
- (b) The program prints **`45`**, not `55`, because `range(1, 10)` stops at `9` and **misses the `10`** — the exclusive-stop off-by-one. The fix is to make the stop `11`:python
total = 0
for n in range(1, 11):
total += n
print(total)
``
Output (run-verified):55`.
Canvas placement block
canvas_object = Assignment
title = "Week 6 Assignment — Loops that Count & Build (traditional)"
assignment_group = "Assignments"
points_possible = 100
grading_type = points
assignment_type = traditional
submission_types = [online_upload, online_text_entry]
due_offset_days = 6
published = true
rubric_ref = "week-06-assignment-rubric"
provenance = "~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com"
~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com