Python Language

Python is a simple but powerful scripting language. It was developed by Guido van Rossum in the Netherlands in the late 1980s. The language takes its name from the British comedy series Monty Python's Flying Circus. Python is an interpreted language unlike C or Fortran that are compiled languages.

Why Python?

This means that you can be productive quite easily and fast. You will be spending more time solving problems and writing code than grappling with the idiosyncrasies of the language.

Your First Program

You can use Python interactively. When you start Python in the interactive mode you will see the following prompt >>>. Your first interaction and response will be as follows:

>>> print ("Hello World!")
Hello World!

For longer programs you can store your program in a file that ends with a .py extension. Save your first program in a file called It will have a single statement - print ("Hello World!") . To run your program, type at the command line

> python

You can also create a stand alone script. On a Unix / Linux machine you can create a script called This script will contain the following lines of code:

print ("Hello World!")

Before you run it, you must make it into an executable file.

> chmod +x

To run the script, you simply call it by name like so:

> ./

For complex problems, you will break up the task of solving the problem into separate subtasks. Each of the subtasks will be implemented as one or more functions. There will be a main function that will call these other functions to implement the solution. Even for the simplest problems, where you do not have any auxiliary functions, write the main() function and call it. The skeleton of your Python code will look like:

def main():


A couple of things to remember about Python programs.