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

Practice exercises for this week

short · graded
  • wk02.p4
    Score-to-grade decoder
    Ask the user for a score out of 100 and print the grade they earned. The straightforward way to practice if, elif, and else on a single number.
    ~15–25 minView →
  • wk02.p5
    Application status responder
    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.p6
    Scholarship shortlist printer
    Keep several scholarships under one label, then walk through them with a for loop and print each on its own line. The cleanest way to practice a list and a loop together.
    ~15–25 minView →
  • wk02.p7
    Application fee tally
    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.p8
    Challenge — number guessing game
    The computer picks a secret number; the player keeps guessing until they get it. Your first real game — it pulls together a while loop, input, int(), comparisons, and a counter into one program.
    ~40–60 minView →
  • wk02.p9
    Challenge — rock, paper, scissors
    Play best-of against the computer. Combines a list of valid moves, in to check input, comparisons to decide the winner, a while loop to keep playing, and counters for the score.
    ~45–60 minView →
  • wk02.p10
    Challenge — mini quiz game
    Run a short quiz from two parallel lists — questions and answers — and score it. The purest combiner: a list, indexing, a for loop, a counter, and a comparison, no new tools at all.
    ~30–45 minView →
  • wk02.p11
    Reusable greeting function
    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, and return.
    ~20–30 minView →
  • wk02.p12
    Pass-or-fail verdict function
    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 return click: the caller decides what to do with the answer.
    ~25–35 minView →
  • wk02.p13
    Read the function
    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.p14
    Plan the shop program
    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.p15
    Plan the school results program
    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.p16
    Scholarship records
    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.p17
    Tally the responses
    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.p18
    Application fee calculator
    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.p19
    Group scholarships by country
    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.p1
    Market basket — work a list end to end
    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.p2
    Mini contacts book
    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.p3
    Word frequency counter
    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
in 2 weeks
Read brief →