Lecture: Booleans, Logical Expressions, Predicates, and Conditionals

Slides

Important Note

Ideally, we would cover the Lec 6 Booleans and Lec 7 Conditionals material on a Friday and Tuesday, so that you would have a Wed/Thu lab on Wed on these topics. But this semester, we are missing the Tue Feb 19 lecture (which is treated as a Wellesley Monday). In order for you to get an overview of both topics before the Feb 20/21 labs, we're asking you to read some slides from Lec 6 Booleans and some slides from Lec 7 Conditionals for the Fri Feb 15 lecture. We will continue with the remaining slides on Fri Feb 22nd.

A PDF file of the lecture slides handout on Booleans, Logical Expressions, and Predicates. Read slides 1 to 12 (inclusive) for Fri Feb 15, and the remaining slides for Fri Feb 22.

A PDF file of the lecture slides handout on Conditionals. Read slides 1 to 8 (inclusive) for Fri Feb 15, and the remaining slides for Fri Feb 22.

Optional Slides

We have briefly discussed local and global variables. If you are interested in learning more about them, read this (short) deck of slides.

Handout on local and global variables.

Readings

Think Python, Ch. 5: Conditionals [Sections 5.1 - 5.7].

Code

Click on this lec_booleans_conditionals.zip link to download the .zip file to your computer. The unzipped folder contains the notebook for lecture activities.

Solutions (for after class)

Use these sample solutions for review only after you have completed the code exercises. You will learn much more by trying them first and comparing your approach with the solutions.

I have made a genuine effort to complete the code exercises. Show me the solutions.