1. Conditional Statements (if, elif, else)
Used to execute different code based on conditions.
Syntax
if
Runs only if the condition is True.
if...else
if...elif...else
Checks multiple conditions.
Nested if
Short Hand if
Short Hand if…else (Ternary Operator)
Logical Operators
and
Both conditions must be True.
or
At least one condition must be True.
not
Reverses the result.
Comparison Operators
Membership Operators
Identity Operators
Quick Revision
Conditional Statements
if→ Check one condition.elif→ Check another condition.else→ Runs if all conditions are False.- Nested
if→ifinside anotherif. - Ternary operator → Short
if-else.