Lecture 4 – Comparisons and Boolean Operators

Data 6, Summer 2021

Review exercise – growth rates

$$\text{FV} = \text{PV} (1 + i)^t$$

NoneType and bool

NoneType

Pay attention to what happens here.

bool

Keywords

Quick Check 1

Comparisons

Comparing different types

Floating point issues, revisited

String containment

Quick Check 2

Boolean operators

Quick Check 3

Demo

The first cell contains code that's mostly copied from last lecture. Ignore it once again!

Below, assign first_or_last to a string containing a single lowercase letter. We'll look at the distribution of populations of countries whose names either begin or end with first_or_last.