CurriculumWeek 02 · Organizing data
Week 02 · starts May 25
Organizing data
Stop writing one-line scripts. Start organizing information so your programs can handle real-world messiness.
Upcoming
Sessions
- 02.01Lists, going deeper~28 min readOpen →Indexing, slicing, append, modifying. Membership with
in. A light first taste of list comprehensions.~28 min readOpen → - 02.02Dictionaries and structured data~25 min readOpen →Keys vs. values. Nested data (lists of dictionaries). Looping over a dictionary like a human.~25 min readOpen →
- 02.03Files, error handling, and going local~36 min readOpen →Opening files. Reading and writing text.
withstatements.try/except. Then we switch from Colab to local Python together.~36 min readOpen →
Practice exercises for this week
short · graded
- wk02.p4Score-to-grade decoder~15–25 minView →Ask the user for a score out of 100 and print the grade they earned. The straightforward way to practice
if,elif, andelseon a single number.~15–25 minView → - wk02.p5Application status responder~20–30 minView →Ask the user the status of their scholarship application and print a tailored response. This time the comparisons are on text, not numbers — the same
if / elif / else, applied to strings.~20–30 minView → - wk02.p6Scholarship shortlist printer~15–25 minView →Keep several scholarships under one label, then walk through them with a
forloop and print each on its own line. The cleanest way to practice a list and a loop together.~15–25 minView → - wk02.p7Application fee tally~20–30 minView →Total a list of application fees with a loop. Practice the start-at-zero, add-one-at-a-time pattern you'll reuse all term for counting and averaging.~20–30 minView →
- wk02.p8Challenge — number guessing game~40–60 minView →The computer picks a secret number; the player keeps guessing until they get it. Your first real game — it pulls together a
whileloop,input,int(), comparisons, and a counter into one program.~40–60 minView → - wk02.p9Challenge — rock, paper, scissors~45–60 minView →Play best-of against the computer. Combines a list of valid moves,
into check input, comparisons to decide the winner, awhileloop to keep playing, and counters for the score.~45–60 minView → - wk02.p10Challenge — mini quiz game~30–45 minView →Run a short quiz from two parallel lists — questions and answers — and score it. The purest combiner: a list, indexing, a
forloop, a counter, and a comparison, no new tools at all.~30–45 minView → - wk02.p11Reusable greeting function~20–30 minView →Write one function that builds a greeting, then call it on a whole list of applicants. Your first taste of writing a routine once and reusing it —
def, a parameter, andreturn.~20–30 minView → - wk02.p12Pass-or-fail verdict function~25–35 minView →Write a function that takes a score and returns a verdict, then use what it hands back — count how many scores pass. The exercise that makes
returnclick: the caller decides what to do with the answer.~25–35 minView → - wk02.p13Read the function~20–30 minView →Ten short Python functions, already written for you. For each one, answer four questions in plain words — its name, what it needs, its job, and whether it returns an answer. No code to write or run; this is pure reading, to make functions click before you write your own.~20–30 minView →
- wk02.p14Plan the shop program~25–40 minView →A small provision shop wants a program to handle a sale. You won't write any code — you'll plan the functions the program needs, describing each one in plain words: its name, what it needs, its job, and whether it hands back an answer.~25–40 minView →
- wk02.p15Plan the school results program~25–40 minView →A school wants a program to handle a student's results. You won't write any code — you'll plan the functions the program needs, describing each one in plain words: its name, what it needs, its job, and whether it hands back an answer.~25–40 minView →
- wk02.p16Scholarship records~25–35 minView →Keep several scholarships as a list of dictionaries, then loop through to print them and filter the ones still open. This is the shape of real data — one record per dictionary, all of them in one list.~25–35 minView →
- wk02.p17Tally the responses~25–35 minView →Count how many times each answer appears using a dictionary — the classic counting pattern, where
.get()with a default does the heavy lifting.~25–35 minView → - wk02.p18Application fee calculator~20–30 minView →Keep a price list in a dictionary, then add up the cost of one applicant's order. Dictionary lookup meets the start-at-zero totalling pattern.~20–30 minView →
- wk02.p19Group scholarships by country~30–40 minView →Turn a flat list of scholarship records into a dictionary that groups them by country. The 'group by' pattern — a dictionary whose values are lists — that you'll use on real data forever.~30–40 minView →
- wk02.p1Market basket — work a list end to end~25–35 minView →Build a small shopping list, then use every list move from the lesson — indexing, slicing, append, remove,
in. Short but covers the ground.~25–35 minView → - wk02.p2Mini contacts book~30–40 minView →Use a dictionary to remember five people and their phone numbers. Look one up, add one, loop over all of them.~30–40 minView →
- wk02.p3Word frequency counter~30–40 minView →Count how many times each word appears in a sentence. The classic exercise that puts dictionaries to honest work.~30–40 minView →
Assignment for this week
Scholarship tracker (CLI)
A command-line tracker that adds, lists, filters, and saves scholarships. Lists of dictionaries, files, and your first piece of persistence.
Due Sun, May 31 · 9:00 pm
Read brief →in 2 weeks