Module 3: Control Flow - Conditional Execution and Loops
Boolean Values and Conditional Execution
Boolean values represent truth and can be either True
or False
.
Conditional execution allows your program to make decisions. The if
statement is fundamental for this.
Syntax: if condition: # code to execute if condition is True
The condition
is an expression that evaluates to True
or False
. The indented code block only runs if the condition is True
.