Lecture 9 – Iteration, Part 1 (for loops)

Data 6, Summer 2021

Motivation

Temperatures taken for the Pacific Northwest from source for June 28 to July 11.

For loops

Example: fares

Let's implement count_above using a for loop, to show how much easier it is. We'll call this function count_above_for.

Quick Check 1

String example

Range

Example: adding lists

Quick Check 2