Introduction to the Python
programming language
GC3: Grid Computing Competence Center,
University of Zurich
Mar. 1920, 2014
Welcome!
Introduction
University of Zurich, GC3: Grid Computing Competence Center
Mar. 1920, 2014
What is the GC3?
A bridge between research
and computational infrastructure
Support scientists in running large-scale data
processing.
Develop tools to better integrate scientific usecases.
Provide access to innovative infrastructures and
technologies.
Want to know more ? http:// www.gc3.uzh.ch
Introduction
University of Zurich, GC3: Grid Computing Competence Center
Mar. 1920, 2014
And what about you?
Introduction
University of Zurich, GC3: Grid Computing Competence Center
Mar. 1920, 2014
Prerequisites
This course assumes a basic experience with
computer programming.
Any language should do, as long as you are already
familiar with the concepts of variables and functions.
Introduction
University of Zurich, GC3: Grid Computing Competence Center
Mar. 1920, 2014
Where to find the course material
These slides and all the example files can be
downloaded from the course web page at:
http://www.gc3.uzh.ch/edu/python
Better keep a browser tab open on that page.
(After the course is over, please rate it and the material
using the feedback form on that same page)
Introduction
University of Zurich, GC3: Grid Computing Competence Center
Mar. 1920, 2014
A helpful tool
The Online Python Tutor is a free tool to visualize the
Online Python Tutor - Visualize program execution
http://pythontutor.com/visu
execution of small Python programs step-by-step.
Frames
1 msg = "Welcome to Python!"
2
Global variables
3 print (msg)
msg
"Welcome to Python!"
Edit code
<< First
< Back
Step 2 of 2
Forward >
Last >>
line that has just executed
next line to execute
Program output:
Feel free to use it for the course exercises and your
own code: http://pythontutor.com/visualize.html
Introduction
University of Zurich, GC3: Grid Computing Competence Center
Generate URL
Mar. 1920, 2014
Objec
Further reading
The Python tutorial,
http://docs.python.org/tutorial/
The Zen of Python in 3 days,
http://pixelmonkey.org/pub/python-training/
Python for Java programmers, http:
//python4java.necaiseweb.org/Main/TableOfContents
For an extensive and commented list, see: https:
//github.com/gc3-uzh-ch/python-course/blob/master/refs.mdwn
Introduction
University of Zurich, GC3: Grid Computing Competence Center
Mar. 1920, 2014
Python 2 vs Python 3
There are currently two major versions of Python
available, with slightly different syntax and features.
Python 2.7 is the last release in the 2.x series.
Python 3.x has a more polished syntax, removing
inconsistencies and some historical baggage.
But Python 2.x is still the default on most Linux
distributions and some major Python packages have
not yet been ported to Py3, so we shall focus on Py2
syntax.
Watch a debate between Pro and Contra advocates:
http:// www.physik.uzh.ch/ nchiapol/ webm/ 3 1 Python3.webm
Introduction
University of Zurich, GC3: Grid Computing Competence Center
Mar. 1920, 2014
Next steps
The course will be structured as a mixture of slides
and hands-on sessions for practicing Python
programming. The GC3 folks are here to help: ask
them questions!
So, the very first step is to set up your workstation so
that you can edit files and run Python code.
Introduction
University of Zurich, GC3: Grid Computing Competence Center
Mar. 1920, 2014