Lesson overview

This week we will focus on repeating tasks and making decisions in Python. Both of these concepts are part of the larger computing idea called control flow, which refers to how the execution of different parts of a computer program is determined. We will learn how to alter the execution of our notebooks using (1) loops, which are used to repeat execution of parts of a program, and (2) conditional statements, which use basic logical tests to determine which parts of a program will be run. The main components of today’s lesson can be found in the navigation bar to the left.

Learning goals

After this weeks lesson your should be able to:

  • Create a for loop and use it to repeat a section of code

  • Use if, elif, and else statements to make decisions in your programs

  • Explain how values can be compared using comparison operators

Lesson videos

Lesson videos will be added after the lesson.

Lesson 3.1 - Repeating tasks with loops

Dave Whipp & Håvard Aagesen, University of Helsinki @ Geo-Python channel on Youtube.

Lesson 3.2 - Conditional statements

Dave Whipp & Håvard Aagesen, University of Helsinki @ Geo-Python channel on Youtube.