Lesson overview

This week we will focus on making decisions and repeating tasks 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 scripts are 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.

  1. Definite loops
  2. Conditional statements
  3. Exercise 3: for loops and conditional statements

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

Lecture

Lesson 3.1 - Repeating tasks with definite loops

Henrikki Tenkanen & Dave Whipp, University of Helsinki @ Geo-Python channel on Youtube.


Lesson 3.2 - Conditional statements

Henrikki Tenkanen & Dave Whipp, University of Helsinki @ Geo-Python channel on Youtube.