Lecture 2: Functions, Logic and Conditionals#

In Lecture 2 we’ll continue our introduction to python. In particular we will teach you

  • How to write functions to perform particular tasks.

    • NOTE All the coursework questions will require you to use functions. Please ask us and/or use the drop-in sessions to get help if you are confused about functions after going through today’s material

  • How to write conditional statements (“if” and “while” blocks) using python.

  • How to use logical operators (and, not, or) in python.

The weekly tasks are split up into a series of sequential notebooks. Any of these can be opened below by clicking on them. Some of these are interactive notebooks, where you will run and/or write code in the cells. To open any of the notebooks interactively, first click on the section, then click on the rocket and select “Colab”.

Weekly tasks#