About Python

Python is a widely used, general purpose programming language.  It was designed to be highly readable and uncluttered.  It is a good language in which to learn computer programming.

It is currently being used by Google and YouTube and NASA. It is free and there is a strong support community.  It is simple and fun but will grow with your skill level.

Python is used for customisation of 3D Blender if you want to combine scripting with animation and 3D modelling. (Note that if you want to use Python 2.6 with Blender, you will need to have at least Blender 2.49 installed.)

Downloading and Setting up Python

The first thing you will need to do is to get Python set up on your computer.  Python is free and can be downloaded from the internet.  There are a number of different versions of Python available.  These notes refer to Python V2.6.2  Although you can use other Python versions, there are some significant variations between versions (especially version 3), so if you are a beginner it would probably be best to use version 2.6 for now. 

After you have downloaded the file, double click to install Python. 

It is easiest to use 'IDLE' to write and run your Python programs.  You should find it on your start menu:


 

 

Your First Program

To run Python, go to your Start Menu, click on Python 2.6, then IDLE (Python GUI).

The window in front of you is the Python 'Shell'.  You should see some text which you can ignore and the prompt which looks like this >>>

Using it you can work in 'interactive mode'.  That means you can type commands and Python will run them as you type each line.

Try typing    print "Hello"          

Press Enter after you have typed it.

Python follows your instructions and prints out on the screen whatever you put in the quotation marks.

If you see the following (or something similar) it means you have most likely made a mistake such as a spelling error or missed out some quotation marks etc.  Python will try to show you what the error is.

 

 
Anything in quotes, (eg "Hello") is a string.  A string is a collection of characters (letters, numbers, symbols etc).  

You can use single or double quotation marks - it doesn't matter, although you must have matching sets.