Why do we need conditionals?
Think of your code like a recipe. Sometimes you need to do something different based on the situation—like "if the oven is hot, put the cake in; otherwise, wait." In Python, we use conditional statements to make these decisions.
If
Starts the check. Runs only if the condition is True.
Elif
Checks another option if the first one was False.
Else
The "catch-all." Runs if nothing else worked.
The Golden Rule: Indentation
Important: Python is strict about spacing! You must use indentation (usually 4 spaces) to show which code belongs to an "if" or "else" block. If you miss a space, your code will crash.
Comparison Operators
To compare values, use these tools:
==(Equal to)!=(Not equal)>(Greater than)<(Less than)