First Program and IDLE Basics

If you are on Windows, from the start menu select python then IDLE. When you open IDLE it opens the interactive widow. This allows you to type lines code and run them. This very is useful for testing small snippets of code.

Type "print ("Hello World!")" in to interactive window of IDLE. We will cover in more what each part of this means in the net section, though note that python is case sensitive.

Pressing return the interactive window returns the text "Hello World!", how exciting! Though this is just getting the interactive window to return some text, this is not a program itself.

 To make this code it to a discrete program that can be saved and ran, we need to create a new window. Selecting file, then new window opens a new window (keyboard shortcut ctrl-N). 


This window allows for longer sequences of code to be wrote and then ran. Type "print ("Hello World!")" in to this window.

Once completed selete Run then Run Module. You will be prompted to save your program.

You may have noticed that the IDLE changes the colours of words that you type, this is to help read the code as different types can be easily seen. This feature will be lost if you do not include the .py at the end of your file name. So if your program turns all black, chances are you need to save it with the .py extension.

Once you have selected a suitable location and filename the program will run and return the same result as before.

Congratulations you have made your first python program!

Next is Comments

Related Sections

Python - Learn the python from the basics up. This fast track example code course will get you creating powerful python programs in no time.
Tkinter - Learn the key features of the tkinter to allow you to create user interfaces for your python programs.

Related Pages

Pickle - The pickle library allows a program to save data in a binary file.
Python - List Comprehension - Create powerful list comprehension expressions.
Python - Generators - Learn about generator statements.
Python - Data types - The learn about the key datatypes in the python language.
Tkinter - Combo Box - This is a short example showing how to use combo boxes in a GUI.
Tkinter - Radio Buttons - A short example of how to create a GUI with radio buttons.
Tkinter - Canvas - Canvas allows for a range of shapes to be plotted, such as circles, squares, lines