In the academic year 18/19 we have modernised the way we use Python to reflect current developments in the use of computing in the scientific community. Instead of requiring students to run Python on a command line, all the new learning resources are based on interactive jupyter notebooks [http://jupyter.org/]. We have developed a new Introduction to Python Handbook, based on jupyter notebooks, which was developed to cater specifically to students who are new to programming. You can access the new Introduction to Python Handbook under "Resources", below.
The Python handbook [https://dmaitre.phyip3.dur.ac.uk/notebooks/l1python/] can be accessed using your CIS username and account. It contains 5 chapters you can access in the “Assignment” tab:
Part 0: introduction
Part 1: Data types and using functions
Part 2: Arrays
Part 3: Conditional Statements, Loops and Creating Functions
Part 4: Saving and Loading Data
Part 5: Plotting
These resources are still useful, but less relevant for the notebook platform.
Introduction to Python: This is the introductory text used in previous years to teach students how to run Python on a command line. This is geared more towards students that are already somewhat familiar to programming.
Python Fresher / Python Revision: These resources are geared towards students that are already familiar with programming. They contain some exercises relating to the material covered in the old introductory handbook.
Python style guide: Professional programmers frequently write programmes according to a strict style-guide. We do not impose a strict style guide but we recommend but we recommend that try to adhere to the style guide: it will make it easier for others (and your future self) to read the code you produce.
Using python and jupyter notebooks outside of the notebook server
You can also run python and jupyter notebooks on your own laptop or computer. To do so you need to install python and jupyter. The easiest way is to use anaconda (https://www.anaconda.com/distribution/). It is widely used in scientific contexts and there is a lot of help and tutorials available on the web.
Useful Python Links
- The Python documentation site (We recommend Python 2.x)
- The "official" Python tutorial
- Magnus Hetland's even quicker tutorial
- All you ever wanted to know about Numpy
- A very good tutorial on numpy and pylab (aka. matplotlib)
- A list of Pylab commands
- A useful list of other Python packages
- Python traps and pitfalls