The second chapter introduces the reader to making decisions in Python programs. The word “selection” refers to selecting between alternatives and the “if” statement in Python is how programmers perform selection in their programs.
Using if statements is a very important aspect of programming but can lead to very complicated and unwieldy programs. Chapter two shows the reader how to properly use if statements in their programs by demonstrating techniques for some common patterns. In particular, the guess and check pattern is introduced to students by examples and practice problems. Boolean (i.e. true and false) values and exception handling are also introduced in this chapter since they both are related to performing selection within a program.