Back Navigation Next Navigation Video 5: Conditionals (page 5 of 10)

Python also supports the if-else statement for alternative execution. In this case, there are two possibilities and the initial Boolean expression in the "if" determines which one gets executed.

The "if" section is fired and executes for the True condition while the "else" section is executed for the False condition. Notice that both the if and else sections end with a ":" and the statements beneath them are indented.

Conditionals