Skip to content

Summary

Summary

Selection structures in Python include if, elif, else, try and except. These selection structures allow certain blocks of code to run or not run based on logical conditions. Logical conditions are expressions or variables that can be evaluated as True or False. You learned to indent code segments after if, elif, and else statements. Standard indentation in Python is four spaces.

The difference between syntax errors and exception errors was demonstrated in this chapter. try/except blocks only check for exception errors.

At the end of the chapter, you learned how to use flowcharts to describe the flow of a program with four basic shapes and arrows.

Key Terms and Concepts

selection structures

if

logical condition

True

False

programmatic flow

indentation

pass

else

else if

elif

exceptions

syntax

syntax error

valid code

exception error

try

except

flow chart