Skip to content

Python

To avoid having to setup a local Python development environment, a good way to get started with Python is to use an online IDE. These can be used from pretty much any device including Windows PCs, Macs, Linux, Raspberry Pi, Android tablets or iPads. At my Code Club I use Replit which has a free tier. See the Replit guide to get started.

MakeCode Arcade also allows you to write your games in Python.

Books

There are a huge range of resources out there for Learning Python and it can be daunting for beginners to identify which are worth their investment in time or money. I recommend the following resources:

Python in easy steps is a concise and low cost overview of the language and the book I use with my learners during Python sessions. The Python challenges I have written contain references to the relevant sections in this book.

The following books are all written by Al Sweigart and available free on his website https://inventwithpython.com. Print versions are available direct from the publisher or Amazon for a fee. There are a range of books covering several topics and 4 that I recommend for Python are:

Invent Your Own Computer Games with Python

Python Programming Exercises, Gently Explained

Making Games with Python & Pygame

The Big Book of Small Python Projects

Code Club Python

Module 1

1 - About Me

2 - Rock, Paper, Scissors

3 - Turtle race

4 - Team Chooser

5 - Colourful Creations

6 - Secret Messages

Module 2

1 - Modern Art

2 - Popular pets

3 - RPG

4 - Where is the Space Station

5 - Robo-Trumps

6 - CodeCraft

Al Sweigart Python

These projects are a curated list of projects and exercises from the four Al Sweigart books listed at the top of this page. The materials are excellent and have been generously made freely available online. If you find them useful and use them, please consider supporting Als generosity by purchasing his books or donating on his website here. Each of the modules below contains some exercises, projects and games. It is recommended that you have already completed Code Club Python before starting these.

Module 1

1 - Project: #15 Deep Cave, The Big Book of Small Python Projects, Al Sweigart

2 - Project: #3 Bitmap Message, The Big Book of Small Python Projects, Al Sweigart

3 - Project: #2 Birthday Paradox, The Big Book of Small Python Projects, Al Sweigart

4 - Exercise: #2 Temperature Conversion, Python Programming Exercises, Gently Explained, Al Sweigart

5 - Exercise: #3 Odd & Even, Python Programming Exercises, Gently Explained, Al Sweigart

6 - Game: Tic-Tac-Toe, Invent Your Own Computer Games with Python, Al Sweigart

Module 2

1 - Project: #10 Cho-Han, The Big Book of Small Python Projects, Al Sweigart

2 - Project: #7 Caesar Hacker, The Big Book of Small Python Projects, Al Sweigart

3 - Project: #5 Bouncing DVD Logo, The Big Book of Small Python Projects, Al Sweigart

4 - Exercise: #4 Area & Volume, Python Programming Exercises, Gently Explained, Al Sweigart

5 - Exercise: #5 Fizz Buzz, Python Programming Exercises, Gently Explained, Al Sweigart

6 - Game: Sonar Treasure Hunt, Invent Your Own Computer Games with Python, Al Sweigart

Module 3

1 - Project: #8 Calendar Maker, The Big Book of Small Python Projects, Al Sweigart

2 - Project: #9 Carrot in a Box, The Big Book of Small Python Projects, Al Sweigart

3 - Project: #13 Conways Game of Life, The Big Book of Small Python Projects, Al Sweigart

4 - Exercise: #9 Chess Square Colour, Python Programming Exercises, Gently Explained, Al Sweigart

5 - Exercise: #10 Find and Replace, Python Programming Exercises, Gently Explained, Al Sweigart

6 - Game: The Reversegam Game, Invent Your Own Computer Games with Python, Al Sweigart

Module 4

1 - Project: #12 Collatz Sequence, The Big Book of Small Python Projects, Al Sweigart

2 - Project: #1 Bagels, The Big Book of Small Python Projects, Al Sweigart

3 - Project: #17 Dice Math, The Big Book of Small Python Projects, Al Sweigart

4 - Exercise: #11 Hours, Minutes, Seconds, Python Programming Exercises, Gently Explained, Al Sweigart

5 - Exercise: #12 Smallest and Biggest, Python Programming Exercises, Gently Explained, Al Sweigart

6 - Game: Memory Puzzle, Making Games with Python & Pygame, Al Sweigart

Module 5

1 - Project: #14 Countdown, The Big Book of Small Python Projects, Al Sweigart

2 - Project: #11 Clickbait, The Big Book of Small Python Projects, Al Sweigart

3 - Project: #4 Blackjack, The Big Book of Small Python Projects, Al Sweigart

4 - Exercise: #14 Average, Python Programming Exercises, Gently Explained, Al Sweigart

5 - Exercise: #17 Dice Roll, Python Programming Exercises, Gently Explained, Al Sweigart

6 - Game: Wormy, Making Games with Python & Pygame, Al Sweigart

Module 6

1 - Project: #16 Diamonds, The Big Book of Small Python Projects, Al Sweigart

2 - Project: #18 Dice Roller, The Big Book of Small Python Projects, Al Sweigart

3 - Project: #22 Ducklings, The Big Book of Small Python Projects, Al Sweigart

4 - Exercise: #18 Buy 8 Get 1 Free, Python Programming Exercises, Gently Explained, Al Sweigart

5 - Exercise: #19 Password Generator, Python Programming Exercises, Gently Explained, Al Sweigart

6 - Game: Simulate, Making Games with Python & Pygame, Al Sweigart

Module 7

1 - Project: #19 Digital Clock, The Big Book of Small Python Projects, Al Sweigart

2 - Project: #21 DNA Visualisation, The Big Book of Small Python Projects, Al Sweigart

3 - Project: #27 Fish Tank, The Big Book of Small Python Projects, Al Sweigart

4 - Exercise: #25 Multiplication Table, Python Programming Exercises, Gently Explained, Al Sweigart

5 - Exercise: #27 Rectangle Drawing, Python Programming Exercises, Gently Explained, Al Sweigart

6 - Game: Tetromino, Making Games with Python & Pygame, Al Sweigart

Module 8

1 - Project: #20 Digital Stream, The Big Book of Small Python Projects, Al Sweigart

2 - Project: #23 Etching Drawer, The Big Book of Small Python Projects, Al Sweigart

3 - Project: #28 Flooder, The Big Book of Small Python Projects, Al Sweigart

4 - Exercise: #23 99 Bottles of Beer, Python Programming Exercises, Gently Explained, Al Sweigart

5 - Exercise: #38 Random Shuffle, Python Programming Exercises, Gently Explained, Al Sweigart

6 - Game: Star Pusher, Making Games with Python & Pygame, Al Sweigart

Challenges

The following materials are designed for self-directed learning once comfortable with writing Python scripts. I recommend only starting the challenges once you have completed Modules 1 and 2 above. Each of the challenges contain references to the book Python in easy steps and I recommend purchasing a copy (though it is not essential).

1 - Guess the number

2 - Higher or lower

Coding Games with Pygame Zero & Python

The following materials are provided freely online by Richard Smith and take the reader from the fundamentals of Python to writing games using Pygame Zero. The website is available here.

Fundamentals

4 - Drawing graphics

5 - Arcade games

6 - Improving your games

7 - More advanced games

Tutorials

8 - Tutorial: Chase game

9 - Tutorial: Maze game

10 - Tutorial: Shooting game

11 - Tutorial: Race game

More Games with Pygame Zero

I have written the following Pygame materials which are designed to be followed after working through the Code Club Python materials. The reader should have a moderate grasp of Python. All of these materials have been designed to work with the online programming IDE Replit.

Module 1 - Building foundations

1 - Muncher (Pac-Man)

2 - Smash (Breakout)

2a - List comprehensions

2b - Classes and inheritance

3 - Memory (Simon Says), coming

4 - Pairs, coming

5 - Bugs (Whac-A-Mole), coming

5b - Improving collision detection, coming

6 - Aliens (Galaxian), coming

Module 2 - Expanding techniques

1 - Paint, coming

2 - Stack (Tetris), coming

3 - Rocks (Missile Command), coming

4 - Fireworks, coming

5 - Jumper (Mario Bros), coming

6 - Toad (Frogger), coming

Tranche 3 - Pushing boundaries

1 - OXO, coming

2 - Race (Outrun), coming

3 - Sandwiches (Burger Time), coming

4 - Invaders (Space Invaders), coming

5 - Collision (Geometry Wars/Asteroids), coming

6 - Concrete (Cement Factory), coming

MakeCode Arcade Python

MakeCode Arcade also allows you to write your games in Python (though it is more limited than Replit and not as mature as the MakeCode Arcade TypeScript tooling). The materials that I initially produced highlighted some issues with the early access Python tooling so we stopped using it. In time, I'm sure the tooling will mature enough for us to use it again. The materials are marked as alpha, beta or final based on the quality/stage of development of the material. The alpha materials will be first stage PDFs, beta are updated web based materials but not neccessarily battle tested in the Coding Club yet so may contain errors and final will be the tested materials.

1 - OXO, alpha

2 - Invaders, alpha

3 - Smash, alpha

4 - Frog, coming

5 - Muncher, coming