Conditionals Preparation
Overview
Frequently you want a program to do one thing in one situation and a different thing some other time. The programming structure that allows for this is a conditional. Today will be focused on the conditional structures in Python and the necessary Boolean values.
Basic Learning Objectives
Before class, you should be able to:
- Define what Boolean values are
- Recognize the
if
/elif
/else
syntax for conditionals - Define what the
and
,or
, andnot
logical operators do - Define what the
in
operator does in the basic case
Advanced Learning Objectives
After class, you should be able to:
- Use basic, nested, and chained conditionals to solve a problem
- Use logical operators to solve a problem
- Predict what code will do when short-circuit boolean evaluation is used
Resources
You should read/watch the following and complete the embedded checks:
- Runestone 8.1-8.9