LOCEN Resources Python

This page gives resources to learn to program in Python and other information and links related to the use of Python.

Learning to program in Python


In general, a lot of information can be found on Python by just searching internet with Google, e.g. with the keyword ''python'' plus the keywords on your problem.

A great application to learn the founding concepts of Python

The following one is a web-site from which you can download a great application for Android smartphones and tables (or for iPhones/Apple tablets). You can also download it in your coputer, so that you have your progresses in different devices. Refers to many programming languages, the part on Python is very nice and useful because: (a) it is done in a way that is compact, progressive, easy to understand; (b) it is very fun and rewarding as it give little pieces of information and after each it proposes you a little programming challenge or question to suppor your better understanding and arise your interest; (c) it also allows gives you a facility to write your programs in Python and test; (d) notwistanding it is very easy it gives you some fundamental notions, e.g. allowing you to understand some elements that differ from C++; (e) if you like it has forums (never needed). 


Good tutorial/reference web-sites

The following web-page gives you a list of all the main key features of Python, easily accessible with a good index. The phylosophy it follows is to give the various key-words/functions of Python, showing you the results if you execute them. It is extremely usful if you already have the main concept of programming as it allows you to learn to program in Python very easily and quickly. Here is the link:



Note that for linear algebra data structures and operators you should use those of the Numpy library (in particular, use the data structure 'array' for 1D vectors, 2D matrices, >2D matrices). On this, see this very good web-page (see also next point):


Scipy Lectures: a very very good web-site on Python for scientific use

An source of information which is extremely useful for scientists is the following one. It is organised in "chapters", and you can also dowload the pdf file (close to 400 pages). It is dedicated to explain Scipy, a set of tools for making science with Python, for example including NumPy for numercal computations (arrays and matrices are the most important for us), MatPlotLib (the most used Python library, very easy to use, allowing publication-quality graphs). It also gives very useful information on Python as a whole costellation of tools (see the very useful first chapter), on programming with Python in general. Other more advanced chapters are useful as reference. Here it is:



Among those resources, a very good and simple tutorial on Python, with interactive examples and short explanations, is this (this is very good to start):

Coursera on-line tuturial

Two very good free course on-line from Coursera (one of the best MOOC ystem for free online courses), very basic, both on programming and on Python, are these:

In depth on-line tutorial

To go more in depth there is this tutorial that also contains many exercises:

Another interesting on-line tutorial


Good online book

A good book on Python online (in English):

Additional information

A lot of information on Python can be also found here (also documentation in Italian):

Other links to web-sites with material and tools useful to learn Python can be also found here:

IDE (Integrated Development Environment) to program in Python


We suggest to instal Python 2, not Python 3, to avoid various compatibility problems.

Reviews on IDEs for Python:



Anaconda Spyder

Most LOCEN members program in Python using the Spyder IDE (but some prefer simpler editors for Linux).

Downloading Anaconda Spyder
A very good development environment for Windows, Mac, and Linux (suggested by many in LOCEN) is Anaconda. This contains Spider Python IDE and many useful libraries:

Installation (Instructions you find in that web-site in the Anaconda web-site)
Download the installer. In your terminal window type one of the below and follow the instructions:
Python 2.7:bash Anaconda2-2.5.0-Linux-x86_64.shPython 3.5:bash Anaconda3-2.5.0-Linux-x86_64.sh
NOTE: Include the "bash" command even if you are not using the bash shell.

Using Spider
To edit and execute the programs use the editor Spider that you can find in the menu of Anaconda after installing it.

Learning to use the basic features of Anaconda Spider IDE
To try out all the features in Anaconda, take the conda 30-minute test drive:http://conda.pydata.org/docs/test-drive.html


A second most popular, good IDE usable under Linux is PyCharm, that you can download from here (the web-site also gives much information on it):


Another good IDE usable under Windows is Canopy, that you can download from here (the web-site also gives much information on it):

Libraries (modules) in Python

List of libraries

A list of libraries for Python (called `modules' in Python georgon) is here:

Graphics libraries

There are two most commonly used Python libraries (`modules') you could use to make graphics, or graphical simulations, in Python.

MatPlotLib is the first library, and is a de-facto standard in Python, gives excellent quality graphs at publication level, and is easy to use:

PyQtGraphs is another library that is less standard than MatPlotLib and much more difficult to learn than it, but is much faster and so very useful for online graphical output and simulations is this: