PythonIntermediate~5hPart 2 of 6

Python Fluency

Choose it before you type it

You can already read Python. This is where you stop writing the first thing that works: pick the container the problem actually asks for, order records by three criteria at once, and turn six lines into the one line a person would rather read.

Modules
7
Drills
12
Build steps
7
Time
~5h

Walk out with

A standings analyzer that ranks a season on points, then goal difference — and the reflex of reaching for the right container without stopping to think.

What you'll do

01

Pick the container

Lists, tuples, dicts, sets — and which one the job wants.

02

See what else changed

Aliases, shallow copies, the default that remembers.

03

Loop, order, reshape

Idiomatic loops, key functions, ties, comprehensions.

04

Make it better

Clearer calls — then rewrite code without changing it.

The pitch

What you practise, and what you leave with

A standings analyzer: match results in, a ranked table out, ties broken on goal difference and then goals scored.

You will practise

  • Pick the container a requirement asks for
  • Spell the line Python wants, from memory
  • Sort records by a tuple key
  • Choose the clearer of two versions

Afterwards you can

  • Choose a representation on purpose
  • Rewrite an index loop the Python way
  • Order by more than one criterion
  • Improve working code without breaking it

Modules

7 modules, 34 items

Lessons explain one idea. Drills repeat it until it sticks. Build steps make something that exists afterwards.

  1. 1

    Choose the shape

    ~38 min

    Read a requirement and pick the type that answers it, before typing anything.

    • LessonWhy the shape comes first5 min
    • LessonFour questions, one answer11 min
    • DrillPick the container10 min
    • Build stepShape the season12 min
  2. 2

    What else changed

    ~35 min

    Predict what a copy actually copied, and what a shared default remembers.

    • LessonThe copy that copied nothing10 min
    • DrillHow deep the copy went10 min
    • LessonThe default that is built once7 min
    • DrillThe default that remembers8 min
  3. 3

    Loop like the language

    ~34 min

    Replace index arithmetic and accumulators with the built-ins that already do them.

    • LessonStop counting by hand8 min
    • DrillRewrite the loop10 min
    • LessonThe loop that was a built-in7 min
    • DrillLet the built-in do it9 min
  4. 4

    Put things in order

    ~55 min

    Rank records by a key, break ties on a second field, and predict a stable result.

    • LessonSorted by what, exactly7 min
    • LessonTwo criteria, one key7 min
    • DrillSort the records11 min
    • LessonStability, and what it buys7 min
    • DrillTies and stability11 min
    • Build stepRank the season12 min
  5. 5

    Change the shape

    ~48 min

    Turn data from one shape into another — and know when one line is worse than four.

    • LessonOne line that earns it9 min
    • DrillRead the comprehension10 min
    • LessonWhere one line stops helping7 min
    • DrillWhich would you rather read12 min
    • Build stepReshape the table10 min
  6. 6

    Say what you mean

    ~35 min

    Write calls that explain themselves — then spell the common lines from memory.

    • LessonCalls you can read8 min
    • DrillWhat the call binds9 min
    • LessonReturn it rather than print it6 min
    • DrillSay it in Python12 min
  7. 7

    Make it better

    ~1h

    Name the defect, rewrite it without changing the output, then finish the analyzer.

    • LessonName it before you fix it8 min
    • DrillFind the defect11 min
    • LessonWhat a rewrite must not change5 min
    • Build stepRewrite without changing it14 min
    • Build stepSay why it is better8 min
    • Build stepPrint the table11 min
    • Build stepFinish the analyzer12 min

Choose the shape before you type. Then say it in one line.

The first item is free. ~5h of focused work, at your own pace.

Intermediate~5h7 modules