Introduction

Before you start

The lectures (including the slides and recordings) in combination with this document should contain all information necessary to complete the exercises. However, there are many excellent reference books available on-line. Many of these can also be ordered in printed form if you find that convenient.

Some suggested resources are listed here, in no particular order:

What you need to get up and running

Python comes in two major versions, Python 2 and 3. This course will use Python 3. The switch from Python 2 to 3 has taken a long time, therefore you might still find many Python 2 materials and examples on-line. However, since this year, Python 2 will not be supported anymore. Pretty much all important scientific libraries have also announced the end of support for Python 2.

For the course Computation for Biologists (NWI-BM066A), everything you need will be installed on the course webserver. You can reach this server at https://jupyterhub20.science.ru.nl. You can login with your Science faculty username and password (note: not your student number!). If you don’t have a science account, contact C&CZ, located in the Huygens building (HG03.055).

Note

You will need to use a VPN when you are not on campus. You can use eduVPN or VPNSec.

The server runs a Jupyter Notebook server, which allows you to edit and run Python code in an interactive environment.

If you want to run Python on your local computer, we recommend to install the Anaconda distribution: https://www.anaconda.com/download/. This installer works on Windows, Mac and Linux and contains all the necessary packages. Jupyter Notebook is part of this distribution, which allows you to run a notebook server locally.

To edit Python code on your local computer you have to use a text editor. Don’t use Word or Notepad! Suggested editors that are freely available include Notepad++ for Windows, TextWrangler for Mac OSX and gedit for Linux. Alternatively, Visual Studio Code is a powerful and free code editor that is available on all platforms.

Final remarks

Note that Python is very particular about spaces: you need to indent the inner body of funtions, for loops and if-statements by exactly 4 spaces.

Don’t be afraid to experiment. Learning by trial and error usually works well for learning to program. Carefully read the error messages if something does not work.

When writing code you have to be very precise. Every character matters. If your code doesn’t work, check for typos first!