Find 21 with binary search
Start in the middle. The first check is 16.
- 3
- 7
- 11
- 16
- 21
- 24
- 30
binary_search.py
while left <= right: middle = (left + right) // 2 if numbers[middle] == target: elif numbers[middle] < target: left = middle + 1 else: right = middle - 1Python Quest by Cuepad
Py100
LeetCode for your kid, with the lessons built in.
Built for kids learning Python. Learn the idea, see it work, then try a challenge. Every chapter is free.
Understand the idea. Then make it work.
Py100 teaches before it tests. Each new idea gets a clear reading, a visual explanation when it helps, and practice sized for a beginner brain.
Step 1
See the idea move
Animations slow an algorithm down to one understandable decision at a time.
Step 2
def find_pair(numbers):
# Your idea goes here
return answer
Write the missing idea
Small starter templates leave the important thinking for the learner.
Step 3
Expected: 6
Three routes arrive from above and three from the left.
Understand every check
Examples explain where the answer came from, not only whether it passed.
From a first loop to dynamic programming.
The book currently spans 20 chapters and 138 challenges. New ideas arrive through reading and gentle practice before the tougher puzzle appears.
No giant jumps. No mystery prerequisites. Just a path that keeps meeting the learner where they are.
- Chapter 1Starter PythonSmall functions, strings, choices, loops, and the first collection moves.10 challenges
- Chapter 5Arrays And StringsWalk through lists and words, build new answers, and compare positions.5 challenges
- Chapter 12Linked ListsBuild node chains, follow references, race pointers, reverse arrows, and merge linked paths.15 challenges
- Chapter 18Graph Map AdventuresFollow one-way missions, detect loops, order dependencies, and grow low-cost weighted networks.10 challenges
- Chapter 20Dynamic Programming WorkshopSolve smaller states once, save their answers, and reuse them for routes, costs, and combinations.10 challenges
When the search space shrinks, they see it shrink.
This is a real Py100 lesson animation. Play it, pause it, or move one decision at a time while the matching Python line stays highlighted.
Interactive trace
Find 91 in a sorted shelf
Every position could still hold the answer, so the whole shelf begins inside the search window.
- 30
- 81
- 142
- 193
- 274
- 335
- 416
- 487
- 558
- 629
- 6810
- 7311
- 7912
- 8413
- 9114
- 9715
- target
- 91
- left
- 0
- middle
- -
- right
- 15
- remaining
- 16
- checks
- 0
def binary_search(values, target): left = 0 right = len(values) - 1 while left <= right: middle = (left + right) // 2 if values[middle] == target: return middle if values[middle] < target: left = middle + 1 else: right = middle - 1 return -1Every lesson. Every challenge. Free.
No trial clock and no locked advanced chapter. A kid can begin with their first function and keep going for as long as curiosity lasts.
