if Statement
The if statement in Python is used to check a condition.
If the condition is True, the program will execute a block of code.
It uses the keyword if.
Explanation
The program checks a condition first.
- If the condition is True → it executes the code
- If the condition is False → it skips the code
It is the simplest decision-making statement in Python programming.
Used when only one action is needed.
Real-Time Scenarios
- If it is raining → take an umbrella
- If you are hungry → eat food
- If the light is off → switch it on
- If homework is done → play games
- If battery is low → charge phone

Syntax
if condition:
# code to execute
Example 1
marks = 60
if marks >= 50:
print("You passed")
Output:
You passed
Example 2
marks = 95
if marks > 90:
print("Excellent!")
Output:
Excellent!
Explanation
- marks >= 50 → checks the condition
- If condition is True, Python executes the code
- Otherwise, nothing happens
Why if Statement is Important
- Helps programs make decisions
- Used in real-world applications
- Builds logical thinking
- Forms the base for advanced coding
Common Beginner Mistakes
- Missing colon (:)
- Wrong indentation
- Using = instead of ==
- Writing invalid conditions
➤ Key Points
if statementchecks a condition- Condition must return True or False
- Uses indentation (space/tab)
- Executes only when condition is True
➤ Tips
- Always use colon (:) after condition
- Keep conditions simple and readable
- Use comparison operators (>, <, ==)
- Practice with small examples