Week 10 — Assignment (Adaptive Learning) · "Build a Lookup, Dedupe a List"
Course: Introduction to Computer Science — CS1 / Programming Fundamentals in Python (CSCI 1101) · Silver Oak University (fictional sample) · Prof. Okafor
Objective assessed: Objective 6 (tuples, dictionaries, sets; choosing a collection) · SLO A (write & run a correct program) · SLO B (trace code; find & fix a defect)
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 10 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 code, and the habit of this course is to confirm output by running it, not guessing — especially this week'sKeyErrorand any printed set.
Part 1 — Student Instructions (read this first)
What this is. An AI coach gives you four problems one at a time — you'll build a dictionary, dedupe with a set, predict output, and fix a 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 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, Nov 8.
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 10 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. NEVER claim a printed set is in a particular order, and NEVER invent a value for a missing dictionary key (that's a KeyError).
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) — Build a word-frequency dictionary ────────────
SHOW ME: "You have this list of words: words = ['sun', 'moon', 'sun', 'star', 'sun', 'moon']. Write a program that builds a dictionary counting how many times each word appears, then prints the dictionary. (Hint: loop over the words; for each one, add 1 to its count.)"
VETTED ANSWER: build counts with a loop, e.g.:
words = ['sun', 'moon', 'sun', 'star', 'sun', 'moon']
counts = {}
for w in words:
counts[w] = counts.get(w, 0) + 1
print(counts)
which prints {'sun': 3, 'moon': 2, 'star': 1}. (An if w in counts: ... else: ... version is equally correct. The key idea is one entry per word with the right count.)
RUBRIC: 25 — a correct loop that tallies each word and prints a dict equal in content to {'sun': 3, 'moon': 2, 'star': 1} (full). Partial: right approach but a bug (e.g., starts counts at 0 wrong, or only counts some) = 12–18; counts without using a dict = 8.
FRESH VARIANT: "Build a contacts dictionary. Start with contacts = {'Sam': '555-1234', 'Ada': '555-9876'}. Add 'Mo' with number '555-2020', then change Sam's number to '555-0000'. Print Sam's number and then len(contacts)." Answer: print(contacts['Sam']) → 555-0000; print(len(contacts)) → 3. Tests add + update + lookup + len; same rubric.
──────────── PROBLEM 2 (25 points) — Dedupe with a set ────────────
SHOW ME: "You have a list of sign-up emails with some duplicates: emails = ['a@x.com', 'b@x.com', 'a@x.com', 'c@x.com', 'b@x.com']. Using a set, write a program that prints how many unique emails there are."
VETTED ANSWER: print(len(set(emails))) (or build unique = set(emails) then print(len(unique))) → 3. Must use a set to dedupe; counting the list length (5) is wrong.
RUBRIC: 25 — uses set(...) to dedupe and prints the count of unique emails, 3 (full). Partial: builds the set but prints the set instead of its length, or prints 5 (didn't dedupe) = 10–15. Manual de-dup loop that's correct also earns full marks (the point is the unique count).
FRESH VARIANT: "A log of visitor IDs has repeats: visits = [101, 102, 101, 103, 101, 102]. Print how many distinct visitors there were, using a set." Answer: print(len(set(visits))) → 3. Same rubric.
──────────── PROBLEM 3 (25 points) — Predict the output ────────────
SHOW ME: "Without running it first, predict EXACTLY what this program prints (both lines), then explain WHY. After you answer, run it to confirm.
d = {'a': 1, 'b': 2}
d['c'] = 3
d['a'] = 9
print(d)
print(len(d))"
VETTED ANSWER: it prints {'a': 9, 'b': 2, 'c': 3} then 3. WHY: d['c'] = 3 ADDS a new pair; d['a'] = 9 UPDATES the existing key 'a' (replacing 1 with 9, NOT adding a second 'a'). So there are three keys, and len(d) is 3. (Dictionaries keep insertion order, so 'c' appears last.)
RUBRIC: 25 — correct dict contents {'a': 9, 'b': 2, 'c': 3} AND len of 3 AND the add-vs-update reasoning (full ≈ 8 for the dict + 8 for len/order + 9 for explaining that d['a']=9 updates rather than adds). Partial: says len is 4 (thought 'a' was added twice) = 12; right values, weak reason = 15.
FRESH VARIANT: "Predict both lines, then run: print(len({5, 5, 6, 7, 7})) and print(8 in {1, 2, 8})." Answer: 3 (the set drops duplicates → {5, 6, 7}) then True (8 is in the set). Same rubric (value + reasoning).
──────────── PROBLEM 4 (25 points) — Find and fix the bug ────────────
SHOW ME: "This program is supposed to print the price of cherries, but it crashes:
prices = {'apple': 50, 'banana': 30}
print(prices['cherry'])
Tell me (a) what error Python gives and why, and (b) fix it so that, when a fruit isn't in the dictionary, the program prints not for sale instead of crashing."
VETTED ANSWER: (a) a KeyError (KeyError: 'cherry') because 'cherry' is not a key in prices, and square-bracket lookup on a missing key crashes (it does NOT return None). (b) The fix uses .get() with a default: print(prices.get('cherry', 'not for sale')) → prints not for sale. (An if 'cherry' in prices: ... else: print('not for sale') version is equally correct.)
RUBRIC: (a) 13 — names KeyError AND the missing-key cause (7 for the cause even if they call the error type loosely). (b) 12 — a fix that prints not for sale for a missing key, via .get(key, default) or an in check. Partial credit for the right idea with a fuzzy explanation.
FRESH VARIANT: "This crashes: rgb = (255, 0, 0) then rgb[0] = 200. What error, why, and how do you 'change' the first value to 200?" Answer: a TypeError ('tuple' object does not support item assignment) because a tuple is immutable; you can't assign to an element — you build a new tuple instead: rgb = (200, 0, 0) → prints (200, 0, 0). Same rubric (cause + fix).
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. For the code-writing problems, if my code would error, tell me to RUN it and read the error, 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.
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 10 ASSIGNMENT — Build a Lookup, Dedupe a List
Student: [name] | Date: ___
Problem 1 (Word-frequency dictionary): a/25 — [one line]
Problem 2 (Dedupe with a set): b/25 — [one line]
Problem 3 (Predict the output): c/25 — [one line]
Problem 4 (Find and fix the bug): 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:
{'sun': 3, 'moon': 2, 'star': 1},3,{'a': 9, 'b': 2, 'c': 3}/3, theKeyErrorand its.get()fix) 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 10 Assignment — Build a Lookup, Dedupe a List (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 = 5
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-10 assignment is the AI-coached, self-scored version in
I-assignment-and-rubric-week-10.md. This file shows the same Week-10 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 6 (tuples, dictionaries, sets; choosing a collection) · SLO A (write & run a correct program) · SLO B (trace code; find & fix a defect)
Worth 100 points · Assignments group = 15% of the grade
The Assignment
This week's collections — dictionaries and sets especially — are where Python starts to feel powerful. In four short parts you'll build a lookup table, dedupe a messy list, predict some output, and fix a crashing program. 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.
Part 1 — Build a word-frequency dictionary (25 pts). You have this list:
words = ["sun", "moon", "sun", "star", "sun", "moon"]
Write a program that builds a dictionary counting how many times each word appears, then prints it. (Hint: loop over the words; for each one, add 1 to its count — counts.get(w, 0) + 1 is one clean way.) Submit the code and its output.
Part 2 — Dedupe with a set (25 pts). You have a list of sign-up emails with duplicates:
emails = ["a@x.com", "b@x.com", "a@x.com", "c@x.com", "b@x.com"]
Using a set, write a program that prints how many unique emails there are. Submit the code and its output.
Part 3 — Predict the output (25 pts). For this program, (a) write down EXACTLY what you think both lines print before running, and (b) explain why in one or two sentences. Then run it and note whether you were right.
d = {"a": 1, "b": 2}
d["c"] = 3
d["a"] = 9
print(d)
print(len(d))
Part 4 — Find and fix the bug (25 pts). This program is supposed to print the price of cherries, but it crashes:
prices = {"apple": 50, "banana": 30}
print(prices["cherry"])
(a) Name the error Python gives and explain why it happens, and (b) fix it so that, when a fruit isn't in the dictionary, the program prints not for sale instead of crashing.
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-10.md.)
Rubric — 100 points
| Criterion (part) | Full credit | Partial | Little/none |
|---|---|---|---|
| Part 1 — Word-frequency dict (25) | A loop that tallies each word into a dict and prints content equal to {'sun': 3, 'moon': 2, 'star': 1} (25) |
Right approach with a bug (miscount, partial), or counts without a dict (8–18) | No working dict / no output (0–7) |
| Part 2 — Dedupe with a set (25) | Uses set(...) to dedupe and prints the unique count 3 (25) |
Builds the set but prints the set instead of its length, or prints 5 (didn't dedupe) (10–15) |
Missing or non-working (0–8) |
| Part 3 — Predict the output (25) | Correct contents {'a': 9, 'b': 2, 'c': 3} and len 3 and add-vs-update reasoning (25) |
Right values, weak reason; or len 4 (thought 'a' was added twice) (10–18) |
Wrong output and reasoning (0–8) |
| Part 4 — Find & fix the bug (25) | Identifies the KeyError + missing-key cause and a fix that prints not for sale (.get(k, default) or in) (25) |
Right fix with a fuzzy explanation, or correct cause but no working fix (10–18) | Neither cause nor fix 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 loop building a count dict, e.g.:
python words = ["sun", "moon", "sun", "star", "sun", "moon"] counts = {} for w in words: counts[w] = counts.get(w, 0) + 1 print(counts)
Output (run-verified):
{'sun': 3, 'moon': 2, 'star': 1}
Anif w in counts: counts[w] += 1 else: counts[w] = 1version is equally correct. Grade on "one entry per word with the right count," not exact key order (insertion order makes this order reliable, but accept any correct mapping). - Part 2:
print(len(set(emails)))→3(run-verified). Must dedupe with a set; printinglen(emails)(5) didn't dedupe. Buildingunique = set(emails)thenprint(len(unique))is the same and full credit. - Part 3: output is
{'a': 9, 'b': 2, 'c': 3} 3
(run-verified). Reasoning:d["c"] = 3adds a new pair;d["a"] = 9updates the existing key"a"(replaces1with9) — it does not create a second"a". So there are three keys andlen(d)is3. (Dictionaries preserve insertion order, so'c'prints last.) - Part 4: (a) Python raises a
KeyError(KeyError: 'cherry') because"cherry"is not a key inprices, andprices["cherry"](square-bracket lookup) crashes on a missing key — it does not returnNone. (b) The fix uses.get()with a default:
python prices = {"apple": 50, "banana": 30} print(prices.get("cherry", "not for sale"))
Output (run-verified):not for sale. Anif "cherry" in prices: print(prices["cherry"]) else: print("not for sale")version is equally correct.
Canvas placement block
canvas_object = Assignment
title = "Week 10 Assignment — Build a Lookup, Dedupe a List (traditional)"
assignment_group = "Assignments"
points_possible = 100
grading_type = points
assignment_type = traditional
submission_types = [online_upload, online_text_entry]
due_offset_days = 5
published = true
rubric_ref = "week-10-assignment-rubric"
provenance = "~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com"
~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com