Python Tutorial‎ > ‎

Tutorial Three

The Basics of Python Programming
This tutorial is for the Python IDLE (GUI) - Graphical User Interface
Click the images to enlarge them

Open a new window [Ctrl] + [N]
In the python IDLE you can write comments by putting a hash (#) at the start of that line, everything on that line will not be compiled.
These comments are very helpful for writing notes on parts of the program or for commenting out parts of the program that you have changed but may want to revert back to.

Any text to be outputted must be put in quotes "Example Text" otherwise it will be confused as being variables, More in the next tutorial.

In the Python IDLE you must know how to do basic maths.
To add numbers together you simply use a plus symbol (+) between the numbers.
 To subtract numbers you simply use a dash symbol (-) between the numbers.

 To multiply you use an asterisk (*)  Press [Shift] + [8]. To divide two numbers you put a backslash (/) between the numbers.

Another commonly used function is the 'print' command. This is used to output text or numbers onto the output window. 
Simply type- print ("Hello World"). In python all commands are written in lower case, for example the command 'print'. Notice how the data to be output is put in quotation marks because it is plain text, in the next tutorial we will start using variables to store and output data. A space is also necessary between the command and the data.
Lets start by typing:    print ("Hello World")
Make sure you are in a new window not the Python Shell. 

Next click-  Run > Run Module (Or Press F5). You will get a prompt asking you to save your program, call it "firstapp", "helloworld" or whatever you want.
It might be a good idea to make a folder called "My python Programs" to store all your programs and keep your folders neat.

Once you have saved your program the python shell will open and it will output- Hello World
Now try with some other text...