In a 30-year programming career, I've learned and used many languages, but never got around to picking up Python. In this post I talked about taking a free course on "Interactive Programming With Python," which teaches Python and how to use it to program graphical interactive games. Eight weeks later, I've just completed it. If you've never programmed before, this is a great way to get started. Along the way you'll create a series of mini projects, from the fairly simple Rock-Paper-Scissors-Lizard-Spock and Guess the Number to Blackjack and Asteroids, complete with animated explosions and sounds. I'm pleased to say that, apart from one project where I misread a requirement, I aced everything.
Bookmark CodeSkulptor.org - Now!
Rice University Prof. Scott Rixner, one of the course's instructors, is a smart cookie with a Ph.D in electrical engineering from MIT. He developed an online website, CodeSkulptor, that lets you edit, save and run Python interactively. It's based on two open-source packages that let you edit and run Python code in your browser with just a button click. It's easy enough for anyone to use it, even those who haven't taken the course. Still, you'll get the most out of it if you have. I'd love to publish links to the games I wrote, but that would harm the course and break the honor code. So you'll just have to take it yourself. (You can sign up for the next one now. There are seven games included with CodeSkulptor anyway, so click the Demos button, view the code, and run it to see how things work. I went a bit over the top with the animation on the Blackjack game, having the card suits cycle round the border, causing Chrome to hit 12 percent of the processor time on my two-year-old PC. On the other hand, it sure looked great!
CodeSkulptor includes color coding of keywords, automatic indentation of the next line after "a :", and code folding to hide/show the body of functions and methods. You can save a copy of the code out at any time with a randomized url that includes an incrementing number. So the first time you save it you get a url like l6^rd3(87hdre-0.py. The next time you save, you'll find the same url but ending in "-1.py", so it will look like: l6^rd3(87hdre-1.py.
You don't have to use the SimpleGUI package for non-GUI programs. Use print statements (which use the Python 2 syntax) that are output on the right-hand panel. Go to CodeSkulptor.org, remove the default program, paste this in, and click the run arrow button.
Print "Look everyone — My first program — wooo!"
Each of the eight-week courses has the same structure. First there is about an hour of videos for the week, split mainly between Scott Rixner and his partner, Rice Prof. Joe Warren. Then there's a weekly tips lecture by John Greiner. The first week had 11 lectures, but by the end of the course there were typically six. Don't forget to admire Joe's course-themed T-shirts and Scott's ties. These two have great on-screen chemistry and their enthusiasm shines through. There are also two quizzes each week. Some of the questions were tricky, and I rarely got a perfect score. There are plenty of concepts and example code used in the video lectures to help you.
The big thing each Saturday is a mini-project assignment for the next week. Experienced Pythonistas will just have a blast, but those of us learning Python will need an hour or so of watching videos to learn what's needed to get going. After the assignments are submitted, you mark at least five of your classmates' projects. I wasn't keen on the marking--it felt like a real chore--but given the thousands of people taking the course, it was the only way for everything to get marked. And since it only took about 10 minutes each week, it wasn't the worst task in the world.
While the course doesn't teach all aspects of Python 2.6, it covers many of the essentials. To give you an idea, here's what was taught:
Comments, strings, numbers, arithmetic operators, arithmetic expressions, variables, functions, indentation, remainders, modules, Boolean expressions, relational operators, conditional statements, event handlers, local variables, global variables, SimpleGUI module, buttons, input fields, Canvas, event-driven drawing, string operations, drawing operations, timers, lists, distance computations, reflections, keyboard events, positional control, velocity control, mutable vs. immutable data, mouse events, list methods, iteration and list comprehension, dictionaries, load and drawing images, object-oriented programming, class fields and methods, tiled images, acceleration and friction, sprites, color, sound, Sets and animations.
Whew! That's quite a curriculum, but it's doable if you can put in seven or eight hours of study time each week. The course fully deserves the 5-star rating it has received on several MOOC rating websites. Make learning game programming with Python one of the New Year's resolutions that you can keep. University-level education that's completely free must have a catch, right? In this case, the only catch is that it's just for the learning--you don't get any credit.