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 that Python uses indentation segment code after if, elif, and else statements. The 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 error

exception error

try

except

flow chart