Conditional Statements
The if Statement
Runs a block of code only if the condition is True.
The else Statement
Use else to run code when the if condition is False.
The elif Statement
Use elif (short for “else if”) to check additional conditions.
Logical Operators
You can combine conditions using and, or, and not.
Nested Conditional Statements
You can nest conditionals inside each other.
Truthy and Falsy Values
In conditionals, Python treats certain values as False:
False,None,0,"",[],{},set()
All other values are truthy.
Common Errors
Some frequent errors encountered when dealing with Conditional Statements in Python.