Saturday, January 28, 2012

A Very Good Place to Start

Everyone (or almost everyone) uses software written by other people. Your operating system, the browser you are using to look at this page, the music player you have open–all of these were written by someone else. (Unless of course you wrote part of them, in which case this blog is not for you.)

A sad reality I've had to face is that no one really cares about computer programming. Programming is something done by other people wielding powers the first group doesn't often understand.  But don't panic; it can be learned.

You may have heard of the languages of C++, Python, Java, or PHP. There are numerous others, but for the purposes of this blog, I'm going to focus on Python. Python is easy to use and very powerful, and the forced-indentation (don't worry; I'll explain what that means later) creates good programming habits. Python is also a strictly(ish) typed language (unlike PHP or Javascript), but I'll talk more about that later.

There's so much that I want to say about Python, but I don't know where to begin. For this first post, let me tell you where you can find Python.

Windows

For Windows users, you will need to download and install the Python Windows Installer found on this page: http://python.org/download/

At the time of this post, the most recent version is 2.7.2. Yes, I know there's a version 3.2.2, but it's a bit different so we won't deal with that here. The link you want to download looks like this:


This is the 32-bit version.  It should still work on 64-bit systems, but if you really want to, try the "Windows X86-64 Installer" below it.

Now just walk through the installation, and let it install where it wants to.



When you're done, open the Command Prompt. If you're on Vista or 7, you can just type "Command Prompt" into the search on the start menu, and it will find it for you. If you are on XP or lower, go to the start menu and select "Run." In the box that appears, type "cmd" and press Enter. You will now get something that looks like this:



To run Python, you should be able to type "python" and press Enter. The window should then look like this:



This is the command line interpreter. Type in 2 + 2 and hit Enter and see what happens. Don't worry; this is not just an overblown calculator, as we shall soon see.


Mac OS X

Mac OS X comes with Python preloaded. To run it, all you have to do is go to the Terminal. To get there, go to Spotlight in the upper-right corner of your screen and type "Terminal" into the text field. The top hit should be an application of the same name (ie Terminal). Open it, and you should get something like this:



Now simply type "python" and you should get something like this:



Again, this is the command line interpreter. Type an expression like 2 + 2 and hit return, and you should see the number four appear below it.



Linux

Like Mac OS X, Linux comes with Python preloaded. But odds are if you are using Linux (or any other OS), you are already beyond the scope of this blog (at least for the foreseeable future).


That's it! Python is up and running, and you're ready to start your programming journey!

No comments:

Post a Comment