Girls’ Programming Network School of Information Technologies
University of Sydney
Outline
1 What is Python?
2 Installing Python
3 Running Python
There are many different kinds of programming languages
Programming languages taught in schools include:
Visual Basic (and Visual Basic .NET)
C#
Java
Python
ColdFusion
To run programs written in some of these languages you will need a program called a compiler. The compiler checks that your program is syntactically correct and then creates an executable version that your computer understands.
We are going to learn Python
Python programs do not need to be compiled - instead they
are run by the Python interpreter.
Python was developed by Guido van Rossum
started over the Christmas break 1989
developed in the early 1990s
while Guido was atCWI andCNRI
name from Monty Python’s Flying Circus
Guido is known as the Benevolent
Dictator for Life (bdfl), meaning that he continues to oversee Python’s development.
Python inherits from abc
Guido previously worked on abc atCWI in the early 1980s
abc was designed for beginners and non-professionals
abc placed a high value on clarity:
blocks identified by indentation minimal use of punctuation one preferred way of doing things
but lacked extensibility and used idiosyncractic syntax and
terminology
Python was designed to appeal to the Unix/C community
So why use Python?
the clean simple syntax is very easy to read and write
it has been called executable pseudo-code
it encourages good programming habits
it still has a lot of power and features:
objects, exceptions, generators, iterators, threads,. . .
but these don’t get in the way of beginners
and a huge standard library (batteries included):
re, os, email, urllib, bsddb
Python scripts are portable to anywhere the interpreter runs
and the interpreter is freely available for:
Still not convinced?
Python lets you get on with writing interesting programs
Python programming is fun!
[Python is] the most efficient language I’ve ever used. It’s 10 times better than any of the other tools I have used. It’s free, it’s object-oriented, it adapts to everything, it runs on everything. There is almost an
indescribable, ’quality without a name’ attraction on my part
Lots of big organisations are using Python
Python is everywhere at ilm. It’s used to extend the capabilities of our applications, as well as providing the glue between them. Every cg image we create has involved Python somewhere in the process.
Philip Peterson, Principal Engineer R&D, Industrial Light & Magic.
Python has been an important part of Google since the beginning, and remains so as the system grows and evolves. Today dozens of Google engineers use Python, and we’re looking for more people with skills in this language.
Download Python from the website
run the Windows installer from http://www.python.org
Installing Python
if possible install Python as user Administrator
Version confusion!
Don’t get Python 2.6a
Don’t get Python 3.0 (a.k.a. Python 3000)
Python is changing over the next couple of years
Don’t worry, you’ll be able to learn the new ways of doing
things easily.
Running Python
Under Unix/Linux, just typepython at the shell prompt
Under Windows, you can run it from a command shell:
goto Start | Run, and enter cmd, and press OK. then type python
Running the Integrated DeveLopment Environment
idle is an ide for Python written in Python
Under Unix/Linux, just typeidle at the shell prompt
Under Windows, goto Start | Programs | Python2.5
Hello World is tiny in Python
Hello World is the canonical first program to write
In Python, Hello World is only one line!
You can type it directly into the Python interpreter:
1 >>> print "hello world"
2 hello world
3 >>>
The colours in this (and all examples) matches the syntax
Writing Python in idle
idle is an ide for Python written in Python
Under Unix/Linux, just typeidle at the shell prompt
Under Windows, goto Start | Programs | Python2.5
You should now be able to:
Convince everyone to code in Python :)
Install and run the Python interpreter under Windows