🚀 Alguni Start learning

🐍 Python for kids

Python is the friendliest first language, and this is all of it a child needs: printing, variables, if, loops, lists, dictionaries, functions, files and classes, one bite-sized lesson at a time.

Start the Python track

How this track is kept honest

Every example runs real Python in the browser — CPython itself, compiled to WebAssembly — so what a lesson says it prints is what Python prints. Each sample is re-run against a real python3 before it ships, and a lesson whose answer no longer matches cannot be merged.

Written for ages 8–15 with no experience at all. Start here if you have never written a line of code.

How it starts

print tells the computer to say something out loud on the screen. Put the words inside quotes and inside the round brackets.

The full Python syllabus

31 units and 160 lessons, in the order they are played. Each unit has a page of its own with every explanation in it, the code samples and what they print, and a few questions to try.

Unit 1: Hello, Python

Make the computer talk

  1. Printing
  2. Boxes for Stuff
  3. Words & Text
  4. Neat Printing
  5. Greeting Machine

Unit 2: Making Choices

Teach your code to decide

  1. True or False
  2. If / Else
  3. And, Or, Not
  4. Bug Squashing
  5. Bouncer Bot

Unit 3: Loops & Lists

Do things again and again

  1. Repeating
  2. Keep Going Until
  3. Lists
  4. Functions
  5. Sending an Answer Back
  6. Guessing Game

Unit 4: Playing with Numbers

Remainders, dice and patterns

  1. Leftovers
  2. Number Helpers
  3. Roll the Dice
  4. Loops Inside Loops
  5. Dice Duel

Unit 5: Words, Deeper

Pull text apart and rebuild it

  1. Letter by Letter
  2. Cutting Slices
  3. String Powers
  4. Looping Over Letters
  5. Word Wizard

Unit 6: Lists & Dictionaries

Collections that grow

  1. Growing Lists
  2. Asking Lists Questions
  3. Dictionaries
  4. Looping Over Dictionaries
  5. Pet Shop

Unit 7: Talking to the Player

Programs that ask questions

  1. Ask a Question
  2. Changing Types
  3. When Things Go Wrong
  4. Keep Asking
  5. Quiz Master

Unit 8: Smarter Functions

Defaults, scope and recursion

  1. Ready-Made Answers
  2. More Than One Answer
  3. Where Names Live
  4. Functions That Call Themselves
  5. Function Workshop

Unit 9: Toolboxes

Borrowing code others wrote

  1. Borrowing Tools
  2. The Maths Toolbox
  3. Dates
  4. Counting Days
  5. Toolbox Master

Unit 10: Sets & Pairs

No repeats, and looping two at a time

  1. No Repeats Allowed
  2. Comparing Sets
  3. Counting As You Go
  4. Two Lists at Once
  5. Set Master

Unit 11: Patterns & Data

match, JSON and finding text

  1. Matching Cases
  2. Saving Data as Text
  3. Finding Patterns
  4. Checking and Changing
  5. Pattern Master

Unit 12: Your Own Types

Building things with classes

  1. Blueprints
  2. Things That Do Things
  3. Printing Nicely
  4. Lots of Objects
  5. Class Master

Unit 13: Families of Objects

Passing abilities down

  1. Passing Things Down
  2. Calling the Parent
  3. Changing Your Mind
  4. Same Word, Different Action
  5. Family Master

Unit 14: Keeping Things Safe

Sharing, hiding and guarding

  1. Shared by Everyone
  2. Methods on the Class
  3. Hands Off
  4. Properties
  5. Classes Inside Classes
  6. Safekeeping Master

Unit 15: Files

Saving things that last

  1. Writing to a File
  2. Reading it Back
  3. Adding More
  4. Checking and Deleting
  5. File Master

Unit 16: Functions as Things

Passing functions around

  1. Functions Are Values Too
  2. Tiny Functions
  3. Map and Filter
  4. As Many As You Like
  5. Functions That Build Functions
  6. Decorators
  7. Function Wizard

Unit 17: Comprehensions

Building lists in one line

  1. Lists in One Line
  2. Choosing As You Build
  3. Counting Things
  4. Dictionaries With a Backup Plan
  5. Comprehension Master

Unit 18: When Things Break

Raising and handling problems

  1. Raising the Alarm
  2. Else and Finally
  3. The Family of Problems
  4. Your Own Kind of Problem
  5. Problem Master

Unit 19: Making Your Own Loops

Iterators, generators and promises

  1. How For Loops Really Work
  2. The Easy Way: yield
  3. Promising a Method Exists
  4. Loop Master

Unit 20: Folders & Paths

Finding your way around

  1. Paths as Objects
  2. Making Folders
  3. Looking Inside
  4. Folder Master

Unit 21: Stacks & Queues

Rules about which end you touch

  1. Boxes in a Row
  2. Stacks
  3. Stacks at Work
  4. Queues
  5. Stack & Queue Master

Unit 22: Linked Lists

Chains of boxes

  1. Nodes and Chains
  2. Walking the Chain
  3. Adding Links
  4. Finding and Removing
  5. Chain Master

Unit 23: Hash Tables

How dictionaries really work

  1. Turning Words Into Numbers
  2. Buckets
  3. When Two Land Together
  4. Hash Master

Unit 24: Trees

Branching structures

  1. Branches
  2. Walking a Tree
  3. Trees That Sort Themselves
  4. Searching Fast
  5. Tree Master

Unit 25: Balanced Trees

Keeping a tree from leaning

  1. When a Tree Falls Over
  2. Straightening It Out
  3. Fixing As You Go
  4. Balance Master

Unit 26: Graphs

Maps, friends and finding paths

  1. Dots and Lines
  2. Spreading Out
  3. Going Deep
  4. Finding a Way Through
  5. Graph Master

Unit 27: Searching

Finding things, slowly and quickly

  1. One at a Time
  2. Counting the Cost
  3. Splitting in Half
  4. Why Halving Wins
  5. Search Master

Unit 28: Sorting

Seven ways to put things in order

  1. Bubble Sort
  2. Selection Sort
  3. Insertion Sort
  4. Merge Sort
  5. Quick Sort
  6. Counting Sort
  7. Radix Sort
  8. Sorting Master

Unit 29: Graph Algorithms

Costs, order and circles

  1. Roads Have Lengths
  2. Dijkstra's Algorithm
  3. Doing Things in Order
  4. Going in Circles
  5. Graph Algorithm Master

Unit 30: Recursion Deeper

Problems inside problems

  1. The Recursive Recipe
  2. When Recursion Explodes
  3. Towers of Hanoi
  4. Every Possibility
  5. Backtracking
  6. Recursion Master

Unit 31: Dynamic Programming

Never solve the same thing twice

  1. Remembering Answers
  2. Building From the Bottom
  3. Counting the Ways
  4. What to Take
  5. Comparing Two Words
  6. DP Master

Other things to learn

Start learning — units 1–2 are free