I am learning to program with python (Part 1)
I am a long term programmer, who completed a degree in software engineering six or seven years ago, and worked in the industry for a few years doing programming in C, C++, Visual basic and a range of other programming languages and then burnt out and had various health complaints. I ended up working with other aspects of computing, and haven’t programmed for four years.
But I did love it, and now I have decided to relearn much of what I used to know.
That part of my life is rather painful, but like all bad things, the memories have started to fade, and I have decided to relearn everything from the ground up, in order to get a job as a games programmer in a few years.
No programming language is easy. Python is not easy, but it is easier as a beginner’s language than many others. Python provides readymade games programming code, so you can get a 2d or 3d game done relatively quickly without too much fuss.
Also, Python is a language I’ve never worked with before, and rebuilding my ability to think computer will, I think, be accomplished better without having half remembered information hampering me.
Ok, end of blather, here is some useful information:
I’ve decided to download five books on python programming, all of which can be obtained legally for free:
Non programmers guide to python by Josh Cogliati
This is the book I’ve started with. I’ve run through most of the exercises, and they are very helpful in providing you with the very basics of programming. It doesn’t go into a great deal of detail, but sometimes you just want a tutorial that goes from
print “hello world”
To very basic file management.
I am not sure how good it would be for a real non-programmer, since it assumes a certain base knowledge of how to think computer.
Invent with python Al Sweigart
A really good book. Provides a lot of games to program. I intend to use the exercises it mentions as a foundation for a series or programming problems, which I will use to get me thinking computer. I’m not going to read the solutions... I am going to program them first hand!
Think Python – Allen Downey
I think this is a better book for the complete novice... it contains a lot of stuff I know, but I think a lot of the exercises are actually quite tough. I am sure I will be working through it.
Learn Python the hard way Zed A Shaw
Another really good book full of programming exercises, which is very good for an experienced programmer. Once you work your way through this and the next book, you will have most of the basic skills needed to program... you’ll just need books on specific aspects of programming like user interfaces, 3d programming or database programming.
Building skills with python Steven F. Lott
Contains quite a lot of advanced computer programming concepts. I will get there... but not yet!
Which version of python I am learning
I have chosen to learn python 2.7. There is a more recent version (3.2) which is not a stable release. At this stage, I am not deep enough into programming that the differences between the two really matters. Later on, I will move to 3.1 when it has a stable release, and is widely supported on Unix operating systems.
How to install python
There are instructions in several of the books mentioned, or you can go to http://www.python.org/download/ . It is free and easy to do.
I don’t really want to go through a full article without writing a single program, so here it is:
And here are the results:
It’s pretty self explanatory, isn’t it? You use the print statement to print a line of text to the python shell. You could replace the text with almost anything between the brackets and it would print it out on the screen.
It’s not a great program, but I guess at least it is better than Hello world, which is the traditional first program to write in a new language. And yeah, I think you should keep the tradition alive, Hello World was the first program I wrote in Python. I’m not posting it here, because it is your first exercise!
What will I do next?
Next I think I will do a basic program to allow users to guess high numbers and low numbers. It will be my first game! Wow! Games programming already... even if it is the most rubbish game you can think of!