Nested Loops Class11 Guide
Nested Loops Class11 Guide
What is a Loop?
A loop repeats a block of code. In Python, we use 'for' or 'while' to run loops.
Example:
Example:
print("-----")
1*1=1
1*2=2
1*3=3
-----
2*1=2
2*2=4
2*3=6
-----
3*1=3
3*2=6
3*3=9
-----
Nested Loops in Python - Class 11 Guide
Example Programs
1. Star Triangle:
print()
2. Square Pattern:
for i in range(4):
for j in range(4):
print()
3. Multiples Table:
print(i * j, end="\t")
print()
Practice Challenges
1. Print:
12
123
Nested Loops in Python - Class 11 Guide
1234
2. Letters Triangle:
AB
ABC
ABCD
3. Hollow Square:
****
* *
* *
****
12345
12345
Summary Table
| Concept | Meaning |
|----------------|----------------------------------|