An intro to Python programming#

Target audience#

This tutorial is created for use in Python introductory courses organized at the Institute for Life Science & Technology (Hanze University of Applied Science, Groningen, The Netherlands). The schedule for the three-week Python module can be found here. The description and schedule for the three-day ITANN course can be found here

To get started#

In order to program with Python you will need to have a Python interpreter on your machine. That is because Python is an interpreted language, not compiled. If you never intend to use notebooks but simply want to write scripts and do interactive coding, simply download an interpreter for your machine from python.org. However, if you want to use Jupyter notebooks and some more handy tools such as QTconsole out-of-the box, go to anaconda.com. The conda package manager is also very nice when you proceed to do some more work that needs third-party libraries.

How to use#

This book contains a series of notebooks transformed into chapters introducing programming concepts in Python. The raw notebooks can be downloaded or cloned from Github. You can view these notebooks interactively on Binder (but slow).
Here is a direct link to open the notebooks folder in Binder: Binder

If you wish to work on the exercises, it is probably best to download the excercises notebook to your local machine from here. You will need to have Python and Jupyter installed on your machine of course. There are no dependencies other that the Python standard library.

Learning goals#

After succesfully attending the course, learners will be able to write basic Python code dedicated to data science challenges.
In more detail, after attending this course, students will

  • use correct data structures and syntax elements for a given purpose:

    • data types (scalars, list, dict, set)

    • flow control elements (if/else, for)

    • functions

  • understand the object-oriented nature of Python

  • run, edit and write Jupyter notebooks

  • read and apply Python documentation using the help() function or online resources

  • deal with a data analysis project in a logical and structured manner (formulate problem, reformulate in separate steps, rewrite in pseudocode, translate to Python)

  • analyse and solve bugs and errors in their own code

  • read data from, and write data to file using Pythons built-in functionality

  • create simple list comprehensions used for generating, filtering and processing collections

  • being able to design, implement and use simple data classes

  • being able to define and use regular expressions

  • creating and using modules

The best Python cheat sheets#

There are many Python cheat sheets available in the public domain to help you get going. Here are a few you may want to pin over your desk for quick reference.

A concise Python3 cheat sheet.
An extensive Python3 cheat sheet .
A Jupyter Notebook cheat sheet which is already present within a running Jupyter instance of course.
A conda cheat sheet.