PGK / KID / 01
Python for kids
Games first, then AI projects.
Open the syllabusUnited States · Ages 9 to 16 · Python and pygame
Plenty of kids who want to learn Python want to make a game with it, and that is a very good instinct. Games give instant feedback: the code either makes the character move or it does not. This page shows how to get there in two steps. First a game that runs in plain Python with nothing to install, then a real arcade game in pygame, a free and long-established Python game library. Along the way there is a version trap worth knowing about before you install anything, and the four-part loop that sits at the heart of every game.
Live teaching since 2020 · 10,000+ students · Python games from the first class
In short
Kids can code Python games in two steps: a text game such as guess the number, which needs only Python and the random module, then graphical games with pygame, installed with pip install pygame. On PyPI, pygame 2.6.1 has ready-built files for Python up to 3.13, so check versions first. Modern Age Coders teaches Python through games, live online, ages 9 to 16.
Learn it live
Each course writes a game in the first weeks, then uses games to teach the ideas behind them.

PGK / 01
Suits 9 to 12: text games, turtle art, then pygame.
Open the syllabus →
PGK / 02
Teens 13 to 18: pygame projects, data and AI.
Open the syllabus →
PGK / 03
Kids 8 to 12: game design across Scratch, Roblox and more.
Open the syllabus →What to build
This is the order we use, because each game adds exactly one new idea to the last one. The first two run in plain Python; the last three need pygame.
| Game | Needs | The new idea | Typical age |
|---|---|---|---|
| 1. Guess my number | Python only | Loops, input and if statements | 9 and up |
| 2. Rock, paper, scissors | Python only | Random choice and comparing values | 9 and up |
| 3. Dodge the falling block | pygame | The game loop, rectangles and collisions | 10 and up |
| 4. Catch the stars | pygame | Lists of moving objects and a timer | 11 and up |
| 5. Two-player Pong | pygame | Velocity, bouncing and two sets of controls | 12 and up |
A text game strips a program down to its logic. There is no window, no images and nothing to install, so a nine-year-old can write a complete, working game in a single lesson and understand every line.
It also teaches the hardest early skill, reading an error message, at a time when the program is short enough that the error is easy to find.
Once a child can write a while loop with an if inside it without help, they are ready. The pygame games on this page are the same structure with a window added.
Teenagers who already type confidently can start at game 3. In our plan, younger children spend a few weeks on games 1 and 2 first.
Game 1
This guessing game needs nothing except Python itself. It uses randint from Python’s random module, which the Python documentation describes as returning a random integer N such that a <= N <= b, so 1 and 100 are both possible.
# Guess my number (ours): plain Python, no installs
import random
secret = random.randint(1, 100)
tries = 0
while True:
guess = int(input("Guess from 1 to 100: "))
tries += 1
if guess < secret:
print("Higher!")
elif guess > secret:
print("Lower!")
else:
print("Got it in", tries, "tries")
breakRun it in IDLE, which the Python docs call Python’s Integrated Development and Learning Environment, or in any Python editor. Typing a word instead of a number stops it with a ValueError, which makes a perfect first bug to fix together.
The clever way to play is to guess the middle every time: 50, then 25 or 75, and so on. Each guess halves the numbers left. Since 2 to the 7th power is 128, which is more than 100, halving finds any number from 1 to 100 in at most 7 guesses. Six guesses are not always enough, because 2 to the 6th is only 64.
Children who work this out have discovered binary search, one of the most important ideas in computer science, by playing their own game.
Limit the player to 7 tries, and print the secret number if they run out. That needs a counter and one more if.
Ask whether they want to play again at the end. That needs a loop around the whole game.
Let the player choose the range, 1 to 1,000 for example, and work out the new maximum number of guesses: 2 to the 10th is 1,024, so 10.
Before you install
pygame describes itself on its PyPI page as a free and open-source cross-platform library for making multimedia applications like video games in Python. Installing it is one command, as long as the Python on the computer is one that pygame has ready-built files for.
| What | Official figure | Source |
|---|---|---|
| Latest pygame | 2.6.1, files uploaded 29 September 2024 | PyPI |
| Python versions pygame 2.6.1 has ready-built files for | CPython 3.6 to 3.13, plus some PyPy builds | PyPI file list |
| Python that pygame says it requires | 3.6 or newer | PyPI |
| Newest Python on python.org | 3.15.0, released October 9, 2026 | python.org |
| Latest Python 3.13 release | 3.13.16, released September 30, 2026 | python.org |
| pygame licence | LGPL | PyPI |
On PyPI, the newest ready-built pygame files stop at Python 3.13, while python.org’s big download button now offers Python 3.15.0. PyPI also lists a source package, pygame-2.6.1.tar.gz, but without a ready-built file for your Python, installing means building pygame from that source, a much harder job for a first-time install.
That is a gap between two official pages on one day, not a fault in either project, and it may close when pygame publishes a new release. Check the pygame files on PyPI before you choose a Python.
Our choice, for now: we set up game students on the latest Python 3.13 release, which python.org updated on September 30, 2026, because pygame has ready-built files for it.
When pygame lists files for a newer Python, we move up. The habit we want children to learn is the one behind this table: read the official version list before installing anything.
Sources, read 17 October 2026: pygame on PyPI and python.org downloads. We are not connected with the pygame project or the Python Software Foundation.
How games work
Every game on a screen, from Pong to the largest console game, repeats the same short cycle many times a second. pygame’s newbie guide calls this update, render, wait loop a design pattern that serves as the skeleton of most games.
| Step | pygame code | What the documentation says |
|---|---|---|
| 1. Input | pygame.event.get() | Your program must handle events every frame; not handling them may cause your system to decide the program has locked up |
| 2. Update | Move objects, check colliderect | colliderect returns true if any portion of either rectangle overlaps, except the edges |
| 3. Draw | screen.fill, draw, then pygame.display.flip() | flip updates the contents of the entire display |
| 4. Wait | clock.tick(60) | Clock.tick(40) once per frame means the program never runs at more than 40 frames per second |
A classic beginner slip is leaving out the event loop when a game has no controls yet. pygame’s documentation warns what happens: events pile up, and the operating system may decide the program has frozen.
Handling pygame.QUIT is also what makes the close button on the window work. Without it, the only way out is to force the program to stop.
clock.tick(60) caps the game at 60 frames a second. Movement in the simple games here is counted in pixels per frame, so the frame cap is also what keeps the speed steady from one computer to the next.
Later, students learn the method pygame’s own quick start shows: measure dt, the time in seconds since the last frame, and multiply speeds by it, so movement stays smooth even when frames are uneven.
Game 3
This is the first pygame game our students build. Move left and right, let the white block fall past you, and score a point for every block you avoid. Every line uses a part of pygame that its documentation describes.
# Dodge the falling block (ours): needs pygame
import random
import pygame
pygame.init()
screen = pygame.display.set_mode((480, 640))
clock = pygame.time.Clock()
font = pygame.font.Font(None, 36)
player = pygame.Rect(215, 580, 50, 30)
block = pygame.Rect(random.randint(0, 430), -40, 50, 40)
score = 0
running = True
while running:
# 1. input: handle every event, every frame
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT] and player.left > 0:
player.x -= 6
if keys[pygame.K_RIGHT] and player.right < 480:
player.x += 6
# 2. update: move the block, check for a hit
block.y += 5
if block.top > 640:
block.x = random.randint(0, 430)
block.y = -40
score += 1
if player.colliderect(block):
running = False
# 3. draw, then 4. wait for the next frame
screen.fill("black")
pygame.draw.rect(screen, "orange", player)
pygame.draw.rect(screen, "white", block)
label = font.render(f"Score {score}", True, "white")
screen.blit(label, (10, 10))
pygame.display.flip()
clock.tick(60)
pygame.quit()
print("Final score:", score)Save it as dodge.py and run it after installing pygame. Rect stores a position and a size; its left, right, top, x and y attributes can be read and changed, and colliderect does the collision maths for you.
At 60 frames a second, a block moving 5 pixels a frame falls 300 pixels a second. It starts 40 pixels above the window and is replaced when it passes 640, so it travels 680 pixels, taking about 680 / 300 = 2.27 seconds.
The player moves 6 pixels a frame, 360 pixels a second, and the widest trip across the window is 480 - 50 = 430 pixels, about 1.19 seconds. Because 1.19 is less than 2.27, the player can always escape. Make the block faster than that and the game becomes unfair.
Speed the block up a little each time the score rises. Then add a second block. Then give the player three lives instead of one.
After that, replace the rectangles with images loaded from files, and add a sound when a block is dodged. Each upgrade practises one new part of pygame.
By age
Our guide for US families, by grade. Children vary a lot, and we place each one by what they can already do, not by birthday.
Text games, turtle drawings and simple quizzes. Typing speed is the main limit, so programs stay short and lessons stay playful.
pygame games 3 and 4, with lists, functions and a scoreboard. A good moment to start a folder of finished games.
Pong, then larger projects with classes, sprites and levels. A good stepping stone toward AP Computer Science or a portfolio project.
Not sure where your child fits? Our pages on Python for 10 year olds, Python for 12 year olds and Python for 14 year olds go into each age in more depth, and our text adventure tutorial is another good first game.
From player to programmer
A rough map of where children are, and the next step from each.
| Stage | What it looks like |
|---|---|
| 1. Copier | Types in a game from a page and gets it running |
| 2. Changer | Changes numbers and messages to see what happens |
| 3. Builder | Writes a new game from an empty file using the loop pattern |
| 4. Designer | Balances a game on purpose: speeds, scores, fairness |
Copying is a legitimate start. Professional programmers learned the same way, by typing out code and then breaking it.
The jump to stage 3 is the big one. An empty file is intimidating, and a teacher’s first question can unlock it.
Change one number and run it again. You learn more from ten small experiments than one big plan.
Read the last line of an error first. Python puts the reason there.
The catalogue
Every one runs live with the same teacher each week, in a batch or one to one.
PGK / KID / 01
Games first, then AI projects.
Open the syllabusPGK / KID / 02
Game ideas before typed code.
Open the syllabusPGK / KID / 03
Blocks to games and apps.
Open the syllabusPGK / TEN / 01
pygame, data and real projects.
Open the syllabusPGK / TEN / 02
From pygame thinking to Unity.
Open the syllabusPGK / TEN / 03
A 2D game and Minecraft mods.
Open the syllabusPGK / PRO / 01
Professional engines and tools.
Open the syllabusPGK / PRO / 02
Playable web pages and games.
Open the syllabusPGK / PRO / 03
Build a game with a team, fast.
Open the syllabusHow lessons run
Weekdays or weekends, flexible: choose your batch, or for a very personalised plan choose 1-on-1 at your convenience, weekend mornings or weekdays.
Weekdays
After-school batches across US time zones.
Weekends
Morning batches for families with busy weekdays.
1-on-1
A personal plan, at times you pick.
Each idea arrives inside a game.
Code written by the child, not watched.
Python and pygame installed in class.
The same person, week after week.
From Maine to Hawaii.
Fifteen to twenty students, or one to one.
Student work
Finished work from some of our students. The student labs page shows more.

AI and ML
An AI nutrition coach that reads what you eat and works you toward a target.

AI and ML
A chatbot that answers mathematics and programming questions, built and deployed by a student.

AI and ML
An assistant that helps a young person recognise unsafe situations online.

Web app
A weather forecasting site with live conditions for any location.
Fees
Python and pygame are both free to download, and so is the first lesson. Regular classes are paid by the month in US dollars, with no long contract, and can stop when any month ends.
Free first class
USD 0
no card required
Group batch
USD 100
a month, billed in US dollars
One to one
USD 150
a month, billed in US dollars
What families say
From Google, as the parents wrote it.
★★★★★
"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."
Ria Mukherjee
Parent
★★★★★
"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."
Samriddha Mondal
Student
★★★★★
"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."
Vansh Agarwal
Student
★★★★★
"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."
Sonam Oswal
Parent of Dhairya
★★★★★
"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."
Sonu Goyal
Parent
★★★★★
"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."
Ritu Kedia
Parent
Questions from families
Start with text games such as guess the number and rock, paper, scissors, which need only Python. Then move to pygame for games with a window: dodging blocks, catching stars and two-player Pong.
For learning, yes. Python reads clearly, and the pygame library handles windows, drawing, keyboard input and collisions, so children spend their time on game logic rather than setup.
Yes. pygame's PyPI page describes it as a free and open-source cross-platform library, and lists its licence as LGPL.
Check that Python and pip work with python --version and pip --version, then run pip install pygame. Test it with python3 -m pygame.examples.aliens, a small game that comes with pygame.
On PyPI, pygame 2.6.1 has ready-built files for Python up to 3.13, while python.org now offers 3.15.0. We set students up on the latest 3.13 release until pygame publishes files for newer versions.
We start text games from about 9 or 10, once a child types comfortably, and pygame games from about 10. Teenagers can start with pygame directly.
A text game needs only Python itself, which includes the random module. Graphical games need pygame, which is installed with pip.
It limits the game to at most 60 frames per second. pygame's documentation says that calling Clock.tick(40) once per frame means the program never runs faster than 40 frames per second.
Weekdays or weekends, flexible: choose your batch, or for a very personalised plan choose 1-on-1 at your convenience, weekend mornings or weekdays.
The first lesson is free. Regular classes are billed per month, and the fees panel on this page gives the monthly amount in US dollars.
Elsewhere on this site
More for US families with a young programmer.
What a 10 year old can build.
Bigger projects for high schoolers.
Another first game, step by step.
Choosing a starting language.
Our hub for families across the country.
What happens in a live lesson.
MakeCode Arcade help: jumping, gravity, tilemap levels and lost projects.
Make a Roblox game step by step: devices, three Luau scripts, and safe publishing.
Lua for kids: what it is, how Luau differs, and three programs to run today.
Start here
Tell us whether your child has written any Python before, and what kind of game they would love to make. The first lesson starts there.
Before booking you can read about our teaching or look through every syllabus.
WhatsApp us · +91 91233 66161 · connect@modernagecoders.com
Classes are taught live online by teachers working from India, so the lesson comes to your home in any state. For a fast reply, send us a WhatsApp message.
A priority demo is a full class of about 45 to 60 minutes. After the class the mentor sends a written skill report and a personal learning roadmap on WhatsApp. If you enrol, the demo fee is adjusted against your first month's fee. Share your demo Order ID with us on WhatsApp and we take it off.
Book a priority demo