0% found this document useful (0 votes)
15 views3 pages

Python Pattern Programs Set B

The document contains a series of Python pattern programs that generate various numerical and alphabetical patterns based on a given integer n. Each program is accompanied by its output and the corresponding code that produces the pattern. The patterns include descending and ascending sequences of numbers and letters.
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)
15 views3 pages

Python Pattern Programs Set B

The document contains a series of Python pattern programs that generate various numerical and alphabetical patterns based on a given integer n. Each program is accompanied by its output and the corresponding code that produces the pattern. The patterns include descending and ascending sequences of numbers and letters.
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

SET – B : Python Pattern Programs

1.
54321
5432
543
54
5

Program:
n = 5
for i in range(n, 0, -1):
for j in range(i, 0, -1):
print(j, end="")
print()

2.
1
21
321
4321
54321

Program:
n = 5
for i in range(1, n+1):
for j in range(i, 0, -1):
print(j, end="")
print()

3.
1
12
123
1234
12345
Program:
n = 5
for i in range(1, n+1):
for j in range(1, i+1):
print(j, end="")
print()

4.
5
54
543
5432
54321

Program:
n = 5
for i in range(1, n+1):
for j in range(n, n-i, -1):
print(j, end="")
print()

5.
ABCDE
ABCD
ABC
AB
A

Program:
n = 5
for i in range(n, 0, -1):
for j in range(i):
print(chr(65+j), end="")
print()

6.
A
AB
ABC
ABCD
ABCDE

Program:
n = 5
for i in range(1, n+1):
for j in range(i):
print(chr(65+j), end="")
print()

7.
1 3 5 7 9
1 3 5 7
1 3 5
1 3
1

Program:
n = 5
for i in range(n, 0, -1):
num = 1
for j in range(i):
print(num, end=" ")
num += 2
print()

You might also like