0% found this document useful (0 votes)
2 views

Nested Loop Programs Baby Level

The document contains beginner-level nested loop pattern programs in Python. It includes 12 different tasks, each with code snippets and their respective outputs, demonstrating various patterns such as multiplication tables, star patterns, and number sequences. Each program is designed to help beginners understand the use of nested loops in generating specific outputs.

Uploaded by

19anay112009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Nested Loop Programs Baby Level

The document contains beginner-level nested loop pattern programs in Python. It includes 12 different tasks, each with code snippets and their respective outputs, demonstrating various patterns such as multiplication tables, star patterns, and number sequences. Each program is designed to help beginners understand the use of nested loops in generating specific outputs.

Uploaded by

19anay112009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Nested Loop Pattern Programs (Beginner Level)

Q1. Write a program to print the multiplication table of all numbers from 2 to 5

Code:
for i in range(2, 6):
for j in range(1, 11):
print(f"{i} x {j} = {i*j}")
print()

Output:
2 x 1 = 2
...
2 x 10 = 20

3 x 1 = 3
...
5 x 10 = 50

Q2. Print pattern:**********

Code:
for i in range(1, 5):
print('*' * i)

Output:
*
**
***
****

Q3. Print pattern:1121231234

Code:
for i in range(1, 5):
for j in range(1, i+1):
print(j, end='')
print()

Output:
1
12
123
1234

Q4. Print pattern:1234123121

Code:
for i in range(4, 0, -1):
for j in range(1, i+1):
print(j, end='')
print()

Output:
1234
123
12
1

Q5. Print pattern:4321321211

Code:
for i in range(4, 0, -1):
for j in range(i, 0, -1):
print(j, end='')
print()

Output:
4321
321
21
1

Q6. Print pattern:1223334444

Code:
for i in range(1, 5):
print(str(i) * i)

Output:
1
22
333
4444

Q7. Print pattern:4444333221

Code:
for i in range(4, 0, -1):
print(str(i) * i)

Output:
4444
333
22
1

Q8. Print pattern:1213214321


Code:
for i in range(1, 5):
for j in range(i, 0, -1):
print(j, end='')
print()

Output:
1
21
321
4321

Q9. Print pattern:1224448888

Code:
for i in range(4):
print(str(2**i) * (i+1))

Output:
1
22
444
8888

Q10. Print pattern:AABABC

Code:
for i in range(1, 4):
for j in range(65, 65+i):
print(chr(j), end='')
print()

Output:
A
AB
ABC

Q11. Print pattern:AABABC (in red)

Code:
for i in range(1, 4):
for j in range(65, 65+i):
print(chr(j), end='')
print()

Output:
A
AB
ABC
Q12. Print pattern:1121123211234321

Code:
for i in range(1, 5):
for j in range(1, i+1):
print(j, end='')
for j in range(i-1, 0, -1):
print(j, end='')
print()

Output:
1
121
12321
1234321

You might also like