Programming in Python, Spring 2020

Registration is closed, as the course has reached capacity.

Practical information

The course will take place on three Friday mornings: 6 March, 20 March and 3 April, between 9:30h and 12:30h.
The location is the University Library, Heinsius room (2nd floor).

Your instructors are Peter Verhaar and Ben Companjen, digital scholarship librarians and software engineers at Leiden University Libraries' Centre for Digital Scholarship. If you have any questions or remarks, please feel free to reach out.

Preparations

We request that you bring a laptop to the class with Python 3 installed. If possible, it saves time during the class if you already download the course materials before coming to class.

Install Python

We would like to ask you to bring your own laptop to the classes, and to make sure that you have installed a recent version of Python (Python 3.7 or higher) before coming to the first session. We strongly advise you to install the Anaconda distribution of Python 3. The installation files can be found at the following address:

https://www.anaconda.com/distribution/#download-section

On this page, you can find separate instructions for Windows, Mac and Linux. Next to Python itself, the Anaconda distribution also contains Jupyter Notebook, an environment that can be used to document and to execute Python code. We will use Jupyter Notebooks in this course.

See Anaconda's installation instructions for some important points to consider during installation. For example, the installation path must not contain spaces. If you want to use Anaconda Python from the command line, it helps to add Anaconda to your PATH during the installation, even though this is not recommended by the installer.

If you experience difficulties during the installation of this software, do not hesitate to contact the CDS via email. If necessary, you can make an appointment and ask us to help you install the software. On the 6th of March, the course instructors shall be present in the Heinsius room from 9:00h onwards, to address any technical issues, if needed.

Download the course materials

This is optional, though downloading the course materials beforehand should save some time in class. We may update the materials between classes; if we do we will say so at the start of the class.

The latest version of the course materials is available as a zip file at https://github.com/peterverhaar/PythonCourse/archive/master.zip. When you download and unzip this, make sure you put the directory (PythonCourse-master by default) in a location that you can access from the Jupyter Notebook environment – your home directory should be a good location.

Course setup

In the course Peter en Ben will explain and demonstrate Python programming through live coding and prepared pieces of source code. These pieces are available in the tutorials below. The HTML version can be viewed in the browser directly, the Notebook can be downloaded and opened in Jupyter Notebook.
If you downloaded the zip file, you don't need to download the individual notebooks.

There are exercises to allow you to apply the knowledge; their numbering follows the tutorials.
Solutions are also provided for the exercise questions.

If you like to challenge yourself, have a look at the coding challenges.

Coding challenges

The coding challenges are meant to, well, challenge you to use and combine multiple parts of the tutorial contents.

Don't be afraid to look for documentation and help outside these course materials!

Good luck!

Homework

In addition to following the biweekly classes, we would like you to do a number of tasks in preparation for these sessions.

The homework for the second sesssion on 20 March is as follows:

  • Read the Python tutorial, sections 1 up and until 6.
  • Do all the exercises in the sections 1 up and until 4. Some of these exercises have already been discussed during the class on March 6. Also note that the solutions are also provided on this website.
  • Attempt to write code for Coding challenges 1 and 2.

Slides