CurriculumThe Dragon's Battle Plans

Algorithmic Thinking in Python, for Kids

The same handful of loop shapes shows up again and again in real programs — this topic gives them names.

12 exercises4 lessonsAges 10+PRO
See what PRO unlocks →

What this topic covers

A child who has written a working loop for every earlier topic still often can't compose one for a NEW problem, because nothing in their earlier learning gave that loop shape a name to reach for. Research on this specifically distinguishes knowing syntax from having reusable schemas: novices who understand every keyword still struggle to combine them, because they re-derive each program's structure from scratch instead of recognising 'this is a max-tracking problem' or 'this is a search.' Naming the pattern is the fix this topic is built around.

Three patterns open the topic, taught back to back so their shared shape is visible: tracking the biggest or smallest value seen so far, and counting how many items pass a test — both walk a list once, carrying one value forward. Searching follows as a fourth pattern, then gets a real, counted contrast against a faster option that only works on a sorted list, so the idea that some approaches are genuinely more efficient than others lands as an observed fact rather than an assertion.

The topic closes with a real sorting algorithm, shown as a teaching vehicle rather than a practical tool — Python's own sort is always the right choice in real code — and a section on edge cases most learners never think to test: an empty list, a single item, values that are all identical. Each pattern from earlier in the topic has an assumption baked into it that one of these breaks, and finding that out here is safer than finding it out later.

Python from this topic

scores = [40, 85, 12, 90, 33]
highest = scores[0]
for s in scores:
    if s > highest:
        highest = s
print(highest)

Output

90

Python covered here

  • The max-tracking and min-tracking patterns
  • The counter pattern, and how it differs from an accumulator
  • Search-with-a-flag, and finding a value's position
  • Why binary search needs a sorted list, and roughly how much faster it is
  • Selection sort, as a way to see how sorting actually works
  • Testing a pattern against an empty list, a single item, and identical values

The mistake this topic is built to fix

Common mistakeA child who can write a correct loop for every topic taught so far still starts from a blank page on a new problem, because no earlier lesson gave the loop's SHAPE a name.

The research distinction here is between knowing syntax and having a reusable plan — novices who understand every individual keyword still struggle to compose them into a new program. This topic's whole design is closing that gap by naming the shapes explicitly, so a learner can recognise 'this is a max-tracking problem' instead of re-deriving the loop from nothing.

The lessons, in order

  1. Tracking patterns: max, min, and countThree loop shapes with names — recognise them on sight instead of reinventing them each time.3 exercises
  2. Search patternsChecking one item at a time has a name — and a smarter option exists when the list is sorted.3 exercises
  3. Sorting, and the edge cases every pattern needsWatch a real sorting algorithm work, then find the gaps every pattern from this topic has been hiding.3 exercises
  4. The Dragon's Full Hoard ReportMax-tracking, counting, and searching — all three, on one list, composed without new tricks.3 exercises

Lessons unlock in order within a topic, so nothing arrives before the idea it depends on. This topic is part of PRO — $6.99 unlocks it along with everything else.

Try it now

The very first level needs no account at all — see whether it clicks before signing up for anything.

Play the first level free →