
Invent your Own Computer Games with Python
by Al Sweigart · first published 2009
97% recommend3% neutral
Why HN recommends it
Free, beginner-friendly Python introduction built around writing simple games step by step; suits kids, new programmers, and parents teaching a child to code.
Summarised by Claude from recommending comments
Invent Your Own Computer Games with Python teaches you how to program in the Python. Each chapter gives you the complete source code for a new game, and then teaches the programming concepts from the example. The programs covered include Hangman, Tic Tac Toe, Reversi, Caesar Cipher, Guess the Number, and Dragon Realm. Later chapters cover how to make 2D graphical games using the popular Pygame library. You'll learn how to: * Put together loops, variables, input/output, and flow control statements into working programs * Use data structures such as lists, dictionaries, and tuples * Debug progra
Affiliate links. As an Amazon Associate I earn from qualifying purchases.







…you can forget all about it if she doesn't -- speaking out of personal experience) No Starch [1] has some great books on teaching kids how to code. If you want something game centric you might like "Invent Your Own Computer Games with Python, 4th Edition" by Al Sweigart [2] [1] https://nostarch.com/catalog/kids [2] https://nostarch.com/inventwithpython
on “Ask HN: Teaching an 8 year old with Aspergers to code?” ↗I'm sorry but I don't see how these are for kids. "Monte Carlo Pi Estimator" ?? Some stuff kids would enjoy more: https://inventwithpython.com/ http://www.amazon.com/Python-Kids-Playful-Introduction-Progr...
on “Python Exercises for Kids” ↗I started my 6 year old daughter on Scratch. I think it will fill the bill for your son. It's very visual and includes enough control structures to allow you to make real programs (games and media presentations are its forte.) http://scratch.mit.edu/ Now that she's 8 and has a better understanding of math she's moved on to http://inventwithpython.com/
on “Ask HN: What's the best way to teach my kid to code?” ↗My kid is 13. He didn't ask to learn, I suggested it as a possible activity. I stressed that he doesn't have to want to. We'll know whether he's trying to please his old man or not after awhile. So far he's liked the new and foreign concepts. We did a little bit last summer. Based on that experience I'm changing it up a little, in part by teaching a little more about surrounding concepts like th
on “Shell Programming for Beginners” ↗I recently had a kid that wanted to program as well. He's about 12. Wanted to program games, but didn't get very far in a directX book. I had a couple choices for him, due to some requirements: 1) Something easy to install or didn't have lots of things to install 2) Something with a all-in-one gaming library 3) Something with some sort of community around it. 4) It'd be nice if there was a book
on “Ask HN: My nephew wants to learn programming. What should I recommend?” ↗Another ebook I recently came across is: http://inventwithpython.com/ It teaches python through building basic computer games. A fun way to learn.
on “Ask HN: What should I learn to become a computer scientist?” ↗http://inventwithpython.com/ this isn't a bad book for teaching those simple games.
on “Ask HN: Teaching programming to a 10 year old, and I'm kind of lost” ↗This might be the ticket: http://inventwithpython.com/ . I haven't gone through it really, but the goal of teaching through making games is similar, and I do know he wrote a pretty good clone of gorillas (http://github.com/jesusabdullah/gorillas is my own copy, if it interests you).
on “Land of Lisp: Learn to Program in Lisp, One Game at a Time” ↗Assuming he has a computer and an internet connection, send him this link: http://inventwithpython.com/chapters/ The author has done a fantastic job of capturing the feeling of the Basic Computer Games book where you can just type in the code and fun stuff happens. I've got my 7 year old daughter started on it and she's having a ball.
on “Ask HN: What gift to teach a 7 year-old programming?” ↗If you want a basic primer using python: http://inventwithpython.com/hacking/index.html
on “Can you crack a code?” ↗I'm not sure why `dbooks.org` is hosting this (couldn't even find a link pointing back to the source). If you go to the source[1] you'll find the contents in-full along with a whole bunch of other great stuff[2] from Al Sweigart (an invaluable contributor to computing and an all-around model human being) I'm skeptical of `dbooks.org` and advise to proceed with caution. [1] http://inventwithpyth
I'd recommend Invent Your Own Computer Games with Python (http://pythonbook.coffeeghost.net/book1/index.html). It's free online, and it geared towards exactly that kind of age and setting. It's written for a beginner at programming, and most kids would probably…
on “Ask HN: Programming and Shaping Minds?” ↗To add to this, I'd recommend a particular free book for learning programming through game writing: http://inventwithpython.com/chapters/
on “Ask HN: My nephew wants to learn programming. What should I recommend?” ↗http://inventwithpython.com/ I have two girls (10,7) and they both enjoy this one. Easy to follow.
on “Ask HN: Good programming language for kids” ↗Here is one I recently discoverd: http://inventwithpython.com/ Teaches you python by creating games.
on “Ask HN: Free Programming eBooks” ↗