Class 10 Computer · Chapter 4
Class 10 Computer Chapter 4 Notes – Control Structures in Python (New Syllabus 2026-27)
Free 10th class computer chapter 4 notes for Control Structures in Python, written for the new 2026-27 Punjab Board book. You get clear definitions, short Python programs you can run yourself, and simple explanations of decisions and loops. Read the overview below or download the full notes as a free PDF.
Free PDFs
All Chapter 4 downloads
Every PDF for Chapter 4: notes, short questions, MCQs and exercise solutions. Free to read online or download, no sign-up.
- Complete notes12.2 MB · PDFDownloadRead online
- Short questions6.0 MB · PDFDownloadRead online
- MCQs5.6 MB · PDFDownloadRead online
- Exercise solutions6.7 MB · PDFDownloadRead online
Overview
What Chapter 4 Control Structures in Python is about

Chapter 4 shows how a Python program makes decisions and repeats work. With if, elif and else a program picks a path, for example printing a grade from a student's marks or checking whether a mobile balance is enough for a package. With for and while loops it repeats steps, such as printing a multiplication table or adding up a shopkeeper's daily sales. You will also use range(), stop or skip loop steps with break and continue, and place one structure inside another. Indentation matters a lot in this chapter.
Topics covered in the notes
- 4.1 Control structures: the three ways a program flows.
- 4.2 if, elif and else: conditions, comparison and logical operators, indentation.
- 4.3 The for loop: looping over lists, strings and range().
- 4.4 The while loop: counters, stopping conditions and infinite loops.
- 4.5 break and continue: leaving a loop early and skipping one pass.
- 4.6 Nested structures: nested if statements and nested loops for patterns.
Key terms
- Control structure is a statement that decides the order in which the lines of a program run: in sequence, by selection or by repetition.
- Condition is an expression that gives True or False, such as
marks >= 33. Python uses it to decide what to do next. - Loop is a block of code that runs again and again, either for each item in a sequence (
for) or while a condition stays True (while). - range() is a built-in function that produces a sequence of whole numbers.
range(1, 6)gives 1, 2, 3, 4, 5: the stop value is not included. - Infinite loop is a loop whose condition never becomes False, so it never ends. It usually happens when the counter is not updated.
- Indentation is the space at the start of a line. In Python it shows which statements belong inside an if block or a loop.
Code examples
marks = 78
if marks >= 80:
print("Grade A+")
elif marks >= 70:
print("Grade A")
elif marks >= 60:
print("Grade B")
else:
print("Keep practising")
# Output: Grade An = 7
for i in range(1, 11):
print(n, "x", i, "=", n * i)
# Output: 7 x 1 = 7 ... 7 x 10 = 70total = 0
num = 0
while True:
num = num + 1
if num > 10:
break # leave the loop
if num % 2 == 0:
continue # skip even numbers
total = total + num
print("Sum of odd numbers 1 to 10:", total)
# Output: Sum of odd numbers 1 to 10: 25for row in range(1, 5):
for star in range(row):
print("*", end="")
print()
# Output:
# *
# **
# ***
# ****Questions students ask
What is the difference between a for loop and a while loop?
Use a for loop when you know how many times to repeat or want to go through each item of a list or string. Use a while loop when you repeat until a condition becomes False and you do not know the count in advance.
Why does range(1, 10) stop at 9?
In Python the stop value of range() is never included. range(1, 10) gives 1 to 9, so write range(1, 11) if you want 1 to 10.
What is the difference between break and continue?
break ends the whole loop at once and the program moves to the line after the loop. continue only skips the rest of the current pass and the loop carries on with the next value.
Why do I get an IndentationError?
Python uses spaces at the start of a line to know which statements are inside an if block or loop. Every line in the same block must have the same indentation, usually 4 spaces, and the line before the block must end with a colon.