Class 11 Computer Science – Chapter 9: Flow of Control
Key Concepts
1. Flow of Control – Order in which statements are executed in a program.
2. Types of Statements in Python:
- Empty Statement: pass
- Simple Statement: Single line executable
- Compound Statement: Header + body (e.g., if, for, while)
3. Constructs that govern flow: Sequence, Selection, Iteration
- Sequence: Default order
- Selection: Conditional execution (if, elif, else)
- Iteration: Repetition (for, while)
4. Indentation – Determines grouping of statements.
Selection (Decision) Statements
if condition:
statements
elif condition:
statements
else:
statements
Iteration (Looping) Statements
1. for loop: for i in range(...): ...
2. while loop: while condition: ...
3. break – Exit loop early.
4. continue – Skip current iteration.
Example Programs
Check Even or Odd
num = int(input("Enter any number: "))
if num % 2 == 0:
print("The number is even")
else:
print("The number is odd")
Find Largest of Two Numbers
num1 = int(input("Enter number 1: "))
num2 = int(input("Enter number 2: "))
if num1 > num2:
print(num1, "is greater than", num2)
else:
print(num2, "is greater than", num1)
Triangle Validation
a = int(input("Enter first side: "))
b = int(input("Enter second side: "))
c = int(input("Enter third side: "))
if a + b > c and a + c > b and b + c > a:
print("Triangle can be formed!")
else:
print("Triangle cannot be formed.")
For Loop Example
st = input("Enter any word: ")
for i in st:
print(i)
Revision Tips
- Revise syntax of if, elif, for, while.
- Understand difference between break and continue.
- Practice output tracing exercises.
- Focus on indentation.
- Solve Check Points from textbook (Sumita Arora).
Useful Resources
1. Flow of Control in Python Notes – [Link]
2. Flow of Control PDF – [Link]
3. Check Point Solutions – [Link]
4. YouTube Lecture – Flow of Control (Class 11)