Introduction
In this chapter, we’ll further our understanding of Booleans and Boolean expressions, learn about branching and flow control, comparisons and conditions, and some convenient string methods.
Learning objectives
- You will learn more about Booleans, how to construct a truth table, and how to combine Booleans using the connectives
and
andor
. - You will learn how to write
if
,if
/else
,if
/elif
, andif
/elif
/else
statements in Python, which allow program execution to follow different branches based on certain conditions. - You will learn how to test for identity with
is
, and the difference between equivalence and identity. - You will learn how to represent decisions using and decision trees.
- You will learn a little about input validation.
- You will learn how to use convenient string methods such as
.upper()
,.lower()
, and.capitalize()
.
Terms and string methods introduced
- Boolean expression
- branching
- comparison operator
- conditional
- De Morgan’s Laws
- decision tree
- equivalence
- identity
if
,elif
, andelse
is
- lexicographic order
- string methods
.upper()
,.lower()
, and.capitalize()
- truth value
- truthiness and falsiness
Copyright © 2023–2025 Clayton Cafiero
No generative AI was used in producing this material. This was written the old-fashioned way.