Al Sweigart

inventwithpython.com · Personal blog · on HN since 2009

Al Sweigart writes free books and tutorials teaching Python through games, ciphers, and practical projects for beginners.

What HN saysCommenters recommend his books for beginners who want to learn by building things rather than through academic study, especially for game programming.
100HN people shared it
48linked it in comments
74stories submitted
1.7Kstory points
3 months agolast shared
2009people per year2026

Most-shared posts

  1. 1
    Invent Your Own Computer Games with Python (Free e-Book)
    34 people · 129 points · first shared 2009 · 22 comments on HN
  2. 2
    Learn Python by writing games (free book)
    6 people · 85 points · first shared 2009 · 10 comments on HN
  3. 3
    Cracking Codes with Python
    5 people · 7 points · first shared 2018 · discussion on HN
  4. 4
  5. 5
    Ideas for Game Clones to Code (2012)
    3 people · 163 points · first shared 2012 · 49 comments on HN
  6. 6
    Hacking Secret Ciphers with Python
    3 people · 19 points · first shared 2013 · discussion on HN
  7. 7
    Beyond the Basic Stuff with Python
    3 people · 5 points · first shared 2021 · discussion on HN
  8. 8
    Best explanation on recursion?
    3 people · 4 points · first shared 2012 · discussion on HN
  9. 9
    Invent4thed
    3 people · first shared 2020
  10. 10
  11. 11
    Why I Recommend Against Hackety Hack
    2 people · 48 points · first shared 2012 · 39 comments on HN
  12. 12
  13. 13
    Hacking Secret Ciphers with Python [pdf]
    2 people · 14 points · first shared 2013 · discussion on HN
  14. 14
  15. 15

What HN people wrote when they linked it

dartharva · 2023-01-17
I don't know why jtimiclat's comment recommending Al Sweigart's books got downvoted and faded out, they are indeed quite good for beginners wanting to get their hands dirty with programming instead of cramming it in an academic way. Not to mention they're all freely available and give excellent value for both time and money: https://inventwithpython.com/
Nicksil · 2020-04-25
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://inventwithpython.com/invent4thed/ [2] http://inventwithpython.com/
veganjay · 2016-11-02
You might want to try the following tutorial: http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,… Although, if you need to learn Python you might want to try the free book Inventing Your Own Games With Python https://inventwithpython.com/
devnonymous · 2016-10-06
Learn Python. It is a general purpose language. Since you are specifically looking to start with games or for little pet projects, I would recommend: https://inventwithpython.com/
dkopi · 2016-05-05
QBasic was a truly incredible way to start programming. Today I'd probably recommend python with pygame, and especially the book inventing computer games with python: https://inventwithpython.com/
squidbot · 2015-10-22
35 years ago, I learned with David Ahl's books. I knew nothing, but I could type in what was on the pages and make cool stuff happen on my computer. This engaged my interest and eventually I went on to learning 6502 assembler, register maps, etc, in a quest to do cooler and cooler stuff. I don't know if it would have happened without those books. In trying to find something similar to pique my kids interest, I found Invent With Python to fill the bill, My kids can type it in, and cool things happen. There's a bit more structure than Basic Computer Games, in that it introduces different concepts in a more logical way, but it still captured the magic for my kids of making the computer do what they want. I'm a fan, and my kids still love to code. https://inventwithpython.com/
csense · 2013-05-06
Two words: Video games. Sweigart's tutorials [1] are a perennial favorite. The materials formerly hosted at simpson.edu [2] are also good. [1] http://inventwithpython.com/ [2] http://programarcadegames.com/
Toph · 2012-07-02
Although my son is too young for me to personally comment on how this works, I've read comments on here some time back about other parents teaching their kids python through http://inventwithpython.com/ I think its worth exploring although HUGE disclaimer as I never even glanced over the book. It seems to be in your target audience however.
Mithrandir · 2011-10-09
I highly recommend 'Invent Your Own Computer Games with Python' http://inventwithpython.com and How to Think Like a Computer Scientist http://www.greenteapress.com/thinkpython/thinkCSpy/ Both are great books that walk you through the basics up, without talking down to you. I assume that the kid is on Windows. Using a UNIX-like system (Linux, BSD) is definitely a good way to understand computers better, especially because of the large amount of programming libraries available often by simply running one command. It's not required of course, but it might help him/her. Yet again, it might not. :-) Once they've learned the dynamics of Python (or other) setting up a GitHub account might not be a bad idea.
xrownow · 2010-03-28
http://inventwithpython.com/ I have two girls (10,7) and they both enjoy this one. Easy to follow.
AlSweigart · 2009-11-09
I don't agree that programming has gotten harder, I think it has become easier. What is harder now is finding material to learn programming that is simple for kids but also still "real" programming (not just game creation kits). I wrote a freely available book called "Invent Your Own Computer Games with Python" and released it under a Creative Commons license. It's available at http://inventwithpython.com I think Python makes a great (even superior) replacement for BASIC. Adding in Pygame, and it is much easier and fun to learn programming.
joag · 2010-10-28
I'm trying to learn python and I picked learn python the hard way by Zed Shaw, I don't have a programming background I'm more like a sys-admin combined with a degree in Electrical - Electronic Engineer and the book is really good. I was able to follow the book very well until I got into chapter 23 "Read Some Code", I thought it was a good idea to learn the lansom code as he created it but as I'm learning python and at the same time learning to program the concepts of packages and API's all combined together just didn't help me, so I started reading code from http://inventwithpython.com/, chapter 9 specifically where the real code start to show up; the code in the book is just one file so you can leave packages and API's until you get more background. I providing my personal experience because I'm sure that even HN is a site for programmers there is a fair amount of guys here like me just starting in the world of programming and this can help them a bit. BTW, if some one drops the offer I'll willing to take his place because I really want to learn python + django.
iamwil · 2010-01-26
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 for it. So with those there, there was: Ruby and HacketyHack. http://hacketyhack.heroku.com/ It also has a app framework called shoes that you can use to build both games and apps. However, since _why left, all this requires a lot of hand hold to set up. Lua and Love. http://love2d.org/ Lua is an easy language to pick up as it's pretty minimal, and love's 2D engine is pretty fantastic. I've used it before and it's pretty easy to get started with, and plenty of examples, as well as a vibrant community. Python and Pygame. http://www.pygame.org/news.html Pygame has all of the above, and for me, the final winner, since there was a book that walks the kid along from basic text games to the graphics part. http://inventwithpython.com/
dutchrapley · 2016-10-06
If you have absolutely no experience programming, start with Python. There are three things to learn when programming: 1) language syntax, 2) concepts (conditionals, logic gates, loops, etc.), and 3) how to solve problems. What makes python a good choice is that you don't have to spend too much overhead learning language syntax in order to implement concepts, and you'll easily be able to keep the learning of those two items separate. Once you have a strong foundation in concepts, you can much more easily pick up a different language. The biggest downfall there is that if you decide to later learn Ruby or JavaScript, you might approach a solution as, "This is how I would do it in Python." Don't fall into that trap. Learn the features each language provides and how to use them. Since you mentioned games, there's a couple of books on the topic that are free: http://inventwithpython.com/
eugenekolo2 · 2016-03-03
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-Programming/dp/…
avinassh · 2015-05-27
This repo maintains list of free programming books [0]. Many of the books at Green Tea Press[1] are available for free: - Think Python: How To Think Like a Computer Scientist - Think Bayes: Bayesian Statistics in Python - Think Complexity: Exploring Complexity Science with Python - Think Stats: Probability and Statistics for Programmers - The Little Book of Semaphores - Physical Modeling in MATLAB - Learning Perl the Hard Way few others. Do check the site. Secondly, books by Al Sweigart[2] are also freely available. They include: - Automate the Boring Stuff with Python[3] - Hacking Secret Ciphers with Python - Invent Your Own Computer Games with Python - Making Games with Python & Pygame [0] - https://github.com/vhf/free-programming-books [1] - http://www.greenteapress.com/ [2] - https://inventwithpython.com/ [3] - https://automatetheboringstuff.com/
emeraldd · 2014-12-04
Here's a reasonable conceptual starting point: http://inventwithpython.com/blog/2014/12/02/why-is-object-oriented-pro… For the Java language itself, I'd recommend: http://www.amazon.com/Java-In-Nutshell-5th-Edition/dp/0596007736
elssar · 2012-08-01
It seems like what you want is a learning resource that is geared towards having the learner building something real. In that case you should try Udacity's CS253(http://www.udacity.com/overview/Course/cs253/CourseRev/apr2012). It's a 7 week course that'll teach you how to build a blog using Python and Google App Engine and the video lectures have been recorded by Steve Huffman, co-founder of Reddit. If you want to learn LISP, then there is Land of Lisp(http://landoflisp.com/), which teaches you to make games using LISP, and for Python is the free to download Invent Your Own Computer Games with Python(http://inventwithpython.com/)
cschmidt · 2012-05-21
Which python game book? This one... http://inventwithpython.com/ or some of the others. I'm thinking of doing the same with my son this summer.
corysama · 2012-02-06
Sounds like what she really needs is a local class or club that she can attend regularly. If anyone in San Diego knows of one, that would be a great help! Not being from San Diego, all I can do is point to possibly better self-paced online tutorials. I'd recommend http://inventwithpython.com/chapters/ first. If she can get through that, she can graduate to using http://www.pygame.org Otherwise, there's http://www.codecademy.com/ and http://primerlabs.com/codehero
wyclif · 2010-11-28
It was kind of a joke submission for people new to Python, but I'm glad someone found it useful. It's from the folks who brought us this publication: http://inventwithpython.com/
jesusabdullah · 2010-10-15
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).
karanbhangui · 2010-09-05
http://inventwithpython.com/ this isn't a bad book for teaching those simple games.
mattgratt · 2010-07-25
for how to make games w/ python, invent with python (http://inventwithpython.com/) is pretty cool and free
GrowWebs · 2010-05-08
Another ebook I recently came across is: http://inventwithpython.com/ It teaches python through building basic computer games. A fun way to learn.
torial · 2010-01-26
To add to this, I'd recommend a particular free book for learning programming through game writing: http://inventwithpython.com/chapters/
sixtofour · 2011-05-30
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 the shell, and what processes are. This video came around at exactly the right time. I showed him how to set up VirtualBox, create and destroy a VM, take snapshots and why you'd want to, how to install Linux on the box, and the basics of navigating the shell and running programs. He's learning Python, with Vim and the Python REPL. Last summer I started him on Python 3.0, but this year I've had misgivings about that and he's doing 2.7, because if he does remain interested then any framework or other tool he's likely to use next will be pre-3.0-based. He's admin on his own VM, because I want him to learn "Dad, how do I do this?" and then do it for himself, rather than "Dad, it says it needs your password again." Last year we focused on Invent Your Own Computer Games With Python, http://inventwithpython.com/. It's a fine tutorial, and he/we got through as far as the hangman game. This summer I want to take a more broad perspective, so we'll probably work a little more holistically, sometimes focusing on the little things we're doing to get something working. Like, what is this shell…
alan_p · 2010-03-28
Python comes with a turtle module, which means you can do all the neat drawing stuff you could do in Logo back in the days. Also Python's interactive console provides two helpful functions: help and dir, which let you stay in the console even when you have to look up documentation, check properties of an object or find what else is contained in an imported module. There are other shells for Python that provide other functionality like saving your session's input in a file so you can actually write entire programs in Python for later use. Also there's http://www.inventwithpython.com/, which is aimed at children and lets them create simple games to see results early on. My first programming language was PHP at age 15, so I never had to make the jump from BASIC, but I've seen people stick with BASIC way past its expiry date just because they were used to it, becoming increasingly frustrated with its limitations. I think Python has the advantage that you don't easily hit a wall like that because you are writing in a "real" programming language from the get-go.

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close