Skip to main content Skip to navigation

Python Induction

Python is a general-purpose programming language which is crucial to several of the core HetSys training modules. Many of the workshops in these modules involve interactive notebooks written in this language, and while these do not involve in-depth programming, they are much more approachable for students with more familiarity with the language. We find a lot of our students are already familiar with it to some degree, but several will not be, and it is important that incoming students make use of the summer vacation before they start the taught course to improve their knowledge of the language.

We run a Python Induction Session in Welcome Week, to give everyone a chance to check their Python knowledge is up to scratch. We often use the session to get people familiar with the new laptops they will have just collected.

There is a notebook associated with this session which you might like to try in advance - if it is trivial for you, you might not need the session at all. If you find the notebook hard going, feel free to save it for that session and complete it with the help of the tutor present.

This link should take you to a copy of the Python Induction Notebook: if you save it to Google Drive you can run and edit a copy of your own:

https://colab.research.google.com/drive/1y1ptmEr2DWssaCJypsYgj82v3rCuYmHX?usp=sharing

Links to online tutorials for self-guided learning of the Python programming language.

This material is designed to be completed at your own pace. In the first weeks of the PX913 module, you will have some lectures on Python which will consolidate your understanding, but these will assume you have studied introductory material and have got some practical experience with the basic functionality of things like loops, datatypes such as lists and dictionaries, calling and defining functions and importing modules.

  1. The website of the Python project contains a simple introduction to getting python set up on your own computer and a basic python tutorial. Parts 1-4 (up to 4.6) are enough to get you up-and-running workshop code. It is quite long-winded but assumes no prior knowledge and is ideal for beginners:
    https://docs.python.org/3/tutorial/ 
  2. The website of the SciPy (Scientific Python) project then takes you further in the direction of using Python for scientific applications. Parts 1.1-1.3 largely repeat what is covered above - the most relevant parts are 1.4 and 1.5: https://scipy-lectures.org/intro/index.html
  3. NumPy is a Python package used by nearly everyone doing any kind of scientific computing in Python. It allows you to manipulate arrays of floating-point data with a level of computational efficiency close to that of compiled code. Two pieces of introductory material can be found on their website: a "quickstart" guide (which despite its name is quite long!) at https://numpy.org/devdocs/user/quickstart.html and an "absolute beginners" guide at https://numpy.org/devdocs/user/absolute_beginners.html
  4. The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. They can be used in particular for Python-based interactive notebooks, and indeed that is the format for a number of assessed workshops within our training programme. The Project Jupyter homepage has extensive introductory material. There is also a Jupyter/NumPy tutorial here: https://github.com/kuleshov/cs228-material/blob/master/tutorials/python/cs228-python-tutorial.ipynb

In the Python Induction Session in Welcome Week, we will try a simple Jupyter Notebook-based Python excercise.

The notebook we will work from can be found here: HetSys Python Induction Notebook