Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Pattern Program PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 43

Pattern Programs

Pattern-1:
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print("* "*n)

Pattern-2:
1111111111
2222222222
3333333333
4444444444
5555555555
6666666666
7777777777
8888888888
9999999999
10 10 10 10 10 10 10 10 10 10

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) for j in range(1,n+1):
4) print(i,end=" ")
5) print()

Pattern-3:
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
1  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) for j in range(1,n+1):
4) print(j,end=" ")
5) print()

Pattern-4:
AAAAAAAAAA
BBBBBBBBBB
CCCCCCCCCC
DDDDDDDDDD
EEEEEEEEEE
FFFFFFFFFF
GGGGGGGGGG
HHHHHHHHHH
IIIIIIIIII
JJJJJJJJJJ

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) for j in range(1,n+1):
4) print(chr(64+i),end=" ")
5) print()

Pattern-5:
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
2  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
1) n=int(input("Enter the number of rows: "))
2) for i in range(1,n+1):
3) for j in range(1,n+1):
4) print(chr(64+j),end=" ")
5) print()

Pattern-6:
10 10 10 10 10 10 10 10 10 10
9999999999
8888888888
7777777777
6666666666
5555555555
4444444444
3333333333
2222222222
1111111111

1) n=int(input("Enter the number of rows: "))


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

Pattern-6:
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1

1) n=int(input("Enter the number of rows: "))


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

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
3  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
Pattern-7:
JJJJJJJJJJ
IIIIIIIIII
HHHHHHHHHH
GGGGGGGGGG
FFFFFFFFFF
EEEEEEEEEE
DDDDDDDDDD
CCCCCCCCCC
BBBBBBBBBB
AAAAAAAAAA

1) n=int(input("Enter the number of rows: "))


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

Pattern-8:
JIHGFEDCBA
JIHGFEDCBA
JIHGFEDCBA
JIHGFEDCBA
JIHGFEDCBA
JIHGFEDCBA
JIHGFEDCBA
JIHGFEDCBA
JIHGFEDCBA
JIHGFEDCBA

1) n=int(input("Enter the number of rows: "))


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

Pattern-9:
*
**
***
****
*****
******
*******
nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
4  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
********
*********
**********

Code - 1:

1) n=int(input("Enter the number of rows:"))


2) for i in range(1,n+1):
3) for j in range(1,i+1):
4) print("*",end=" ")
5) print()

Code - 2:

1) n=int(input("Enter the number of rows:"))


2) for i in range(1,n+1):
3) print("* "*i)

Pattern-10:
1
22
333
4444
55555
666666
7777777
88888888
999999999
10 10 10 10 10 10 10 10 10 10

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) for j in range(1,i+1):
4) print(i,end=" ")
5) print()

Pattern-11:
1
12
123
1234
12345
123456
1234567
12345678

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
5  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
123456789
1 2 3 4 5 6 7 8 9 10

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) for j in range(1,i+1):
4) print(j,end=" ")
5) print()

Pattern-12:
A
BB
CCC
DDDD
EEEEE
FFFFFF
GGGGGGG
HHHHHHHH
IIIIIIIII
JJJJJJJJJJ

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) for j in range(1,i+1):
4) print(chr(64+i),end=" ")
5) print()

Pattern-13:
A
AB
ABC
ABCD
ABCDE
ABCDEF
ABCDEFG
ABCDEFGH
ABCDEFGHI
ABCDEFGHIJ

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) for j in range(1,i+1):
4) print(chr(64+j),end=" ")
5) print()

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
6  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
 Squares
 Right Angled Triangle
 Reverse of Right Angled Triangle

Pattern-14:
**********
*********
********
*******
******
*****
****
***
**
*

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) for j in range(1,n+2-i):
4) print("*",end=" ")
5) print()

Pattern-15:
1111111111
222222222
33333333
4444444
555555
66666
7777
888
99
10

1) n=int(input("Enter the number of rows: "))


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

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
7  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
Pattern-16:
1 2 3 4 5 6 7 8 9 10
123456789
12345678
1234567
123456
12345
1234
123
12
1

1) n=int(input("Enter the number of rows: "))


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

Pattern-17:
AAAAAAAAAA
BBBBBBBBB
CCCCCCCC
DDDDDDD
EEEEEE
FFFFF
GGGG
HHH
II
J

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) for j in range(1,n+2-i):
4) print(chr(64+i),end=" ")
5) print()

Pattern-18:
ABCDEFGHIJ
ABCDEFGHI
ABCDEFGH
ABCDEFG
ABCDEF
ABCDE
ABCD
nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
8  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
ABC
AB
A

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) for j in range(1,n+2-i):
4) print(chr(64+j),end=" ")
5) print()

Pattern-19:
10 10 10 10 10 10 10 10 10 10
999999999
88888888
7777777
666666
55555
4444
333
22
1

1) n=int(input("Enter the number of rows: "))


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

Pattern-20:
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2
10 9 8 7 6 5 4 3
10 9 8 7 6 5 4
10 9 8 7 6 5
10 9 8 7 6
10 9 8 7
10 9 8
10 9
10

1) n=int(input("Enter the number of rows: "))


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

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
9  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
Pattern-21:
JJJJJJJJJJ
IIIIIIIII
HHHHHHHH
GGGGGGG
FFFFFF
EEEEE
DDDD
CCC
BB
A

1) n=int(input("Enter the number of rows: "))


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

Pattern-22:
JIHGFEDCBA
JIHGFEDCB
JIHGFEDC
JIHGFED
JIHGFE
JIHGF
JIHG
JIH
JI
J

1) n=int(input("Enter the number of rows: "))


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

Pattern-23:
*
**
***
****
*****
******
*******
nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
10  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
********
*********
**********

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),"*"*i,end=" ")
4) print()

Pattern-24:
*
**
***
****
*****
******
*******
********
*********
**********

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(1,i+1):
5) print("*",end=" ")
6) print()

Pattern-25:
1

22

333

4444

55555

666666

7777777

88888888

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
11  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
999999999

10 10 10 10 10 10 10 10 10 10

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),(str(i)+" ")*i)
4) print()

Pattern-26:
1
12
123
1234
12345
123456
1234567
12345678
123456789
1 2 3 4 5 6 7 8 9 10

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(1,i+1):
5) print(j,end=" ")
6) print()

Pattern-27:
A

BB

CCC

DDDD

EEEEE

FFFFFF

GGGGGGG

HHHHHHHH

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
12  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
1) n=int(input("Enter the number of rows: "))
2) for i in range(1,n+1):
3) print(" "*(n-i),(chr(64+i)+" ")*i)
4) print()

Pattern-28:
A
AB
ABC
ABCD
ABCDE
ABCDEF
ABCDEFG
ABCDEFGH
ABCDEFGHI
ABCDEFGHIJ

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(1,i+1):
5) print(chr(64+j),end=" ")
6) print()

Pattern-29:
*****
****
***
**
*

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(i-1),"* "*(n+1-i))

Pattern-30:
55555
4444
333
22
1

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
13  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
1) n=int(input("Enter the number of rows: "))
2) for i in range(1,n+1):
3) print(" "*(i-1),(str(n+1-i)+" ")*(n+1-i))

Pattern-31:
12345
1234
123
12
1

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(i-1),end="")
4) for j in range(1,n+2-i):
5) print(j,end=" ")
6) print()

Pattern-32:
EEEEE
DDDD
CCC
BB
A

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(i-1),(str(chr(65+n-i))+" ")*(n+1-i))

Pattern-33:
ABCDE
ABCD
ABC
AB
A

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(i-1),end="")
4) for j in range(65,66+n-i):
5) print(chr(j),end=" ")
6) print()

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
14  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
Pattern-34:
*
***
*****
*******
*********

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),"* "*(2*i-1))

Pattern-35:
1
222
33333
4444444
555555555

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),(str(i)+" ")*(2*i-1))

Pattern-36:
A
BBB
CCCCC
DDDDDDD
EEEEEEEEE

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),(str(chr(64+i)+" "))*(2*i-1))

Pattern-37:
A
CCC
EEEEE
GGGGGGG
IIIIIIIII

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
15  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
1) n=int(input("Enter the number of rows: "))
2) for i in range(1,n+1):
3) print(" "*(n-i),(str(chr(64+2*i-1)+" "))*(2*i-1))

Pattern-38:
1
123
12345
1234567
123456789

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(1,2*i):
5) print(j,end=" ")
6) print()

Pattern-39:
1
321
54321
7654321
987654321

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(2*i-1,0,-1):
5) print(j,end=" ")
6) print()

Pattern-40:
A
ABC
ABCDE
ABCDEFG
ABCDEFGHI

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(65,65+2*i-1):

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
16  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
5) print(chr(j),end=" ")
6) print()

Pattern-41:
A
CBA
EDCBA
GFEDCBA
IHGFEDCBA

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(65+2*i-2,64,-1):
5) print(chr(j),end=" ")
6) print()

Pattern-42:
0
101
21012
3210123
432101234

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(1,i):
5) print(i-j,end=" ")
6) for k in range(0,i):
7) print(k,end=" ")
8) print()

Pattern-43:
A
BAB
CBABC
DCBABCD
EDCBABCDE

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
17  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
4) for j in range(1,i):
5) print(chr(i-j+65),end=" ")
6) for k in range(0,i):
7) print(chr(k+65),end=" ")
8) print()

Pattern-44:
1
121
12321
1234321
123454321

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(1,i+1):
5) print(j,end=" ")
6) for k in range(i-1,0,-1):
7) print(k,end=" ")
8) print()

Pattern-45:
A
ABA
ABCAB
ABCDABC
ABCDEABCD

1) n=int(input("Enter the number of rows: "))


2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(1,i+1):
5) print(chr(64+j),end=" ")
6) for k in range(1,i):
7) print(chr(64+k),end=" ")
8) print()

Pattern-46:
1) n=int(input("Enter a number:"))
2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(1,i+1):

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
18  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
5) print(n+1-j,end=" ")
6) print()

5
54
543
5432
54321

Pattern-47:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):
5) print("*",end=" ")
6) for k in range(1,num+1-i):
7) print("*",end=" ")
8) print()

*********
*******
*****
***
*
Pattern-48:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(0,num+1-i):
5) print(num+1-i,end=" ")
6) for k in range(1,num+1-i):
7) print(num+1-i,end=" ")
8) print()

555555555
4444444
33333
222
1

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
19  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
Pattern-49:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(0,num+1-i):
5) print(2*num+1-2*i,end=" ")
6) for k in range(1,num+1-i):
7) print(2*num+1-2*i,end=" ")
8) print()

999999999
7777777
55555
333
1

Pattern-50:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):
5) print(j,end=" ")
6) for k in range(2,num+2-i):
7) print(num+k-i,end=" ")
8) print()

1234567
12345
123
1

Pattern-51:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):
5) print(chr(65+num-i),end=" ")
6) for k in range(2,num+2-i):
7) print(chr(65+num-i),end=" ")
8) print()

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
20  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
EEEEEEEEE
DDDDDDD
CCCCC
BBB
A

Pattern-52:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):
5) print(chr(65+2*num-2*i),end=" ")
6) for k in range(2,num+2-i):
7) print(chr(65+2*num-2*i),end=" ")
8) print()

I I I I I I I I I
G G G G G G G
E E E E E
C C C
A

Pattern-53:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):
5) print(chr(64+j),end=" ")
6) for k in range(2,num+2-i):
7) print(chr(68+k-i),end=" ")
8) print()

ABCDEFG
ABCDE
ABC
A

Pattern-54:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print(j,end=" ")

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
21  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
6) print()
7) for k in range(1,num):
8) print(" "*k,end="")
9) for l in range(1,num+1-k):
10) print(l,end=" ")
11) print()

1
12
123
1234
12345
1234
123
12
1

Pattern-55:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print("*",end=" ")
6) print()
7) for k in range(1,num):
8) print(" "*k,end="")
9) for l in range(1,num+1-k):
10) print("*",end=" ")
11) print()

*
**
***
****
*****
****
***
**
*

Pattern-56:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
22  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
5) print(num-j,end=" ")
6) print()
7) for k in range(1,num):
8) print(" "*k,end="")
9) for l in range(1,num+1-k):
10) print(num-l,end=" ")
11) print()

4
43
432
4321
43210
4321
432
43
4

Pattern-57:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(0,i):
5) print(num+j-i,end=" ")
6) print()
7) for k in range(1,num):
8) print(" "*k,end="")
9) for l in range(1,num+1-k):
10) print(l+k-1,end=" ")
11) print()

3
23
123
0123
123
23
3

Pattern-58:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(0,i):
5) print(chr(65+num+j-i),end=" ")

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
23  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
6) print()
7) for k in range(1,num):
8) print(" "*k,end="")
9) for l in range(0,num-k):
10) print(chr(65+k+l),end=" ")
11) print()

E
DE
CDE
BCDE
ABCDE
BCDE
CDE
DE
E

Pattern-59:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) for j in range(1,i+1):
4) print("*",end=" ")
5) print()
6) for a in range(1,num+1):
7) for k in range(1,num+1-a):
8) print("*",end=" ")
9) print()

*
**
***
****
*****
****
***
**
*
Pattern-60:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) for j in range(1,i+1):
4) print(num-j,end=" ")
5) print()
6) for a in range(1,num+1):
7) for k in range(1,num+1-a):

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
24  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
8) print(num-k,end=" ")
9) print()

4
43
432
4321
43210
4321
432
43
4

Pattern-61:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) for j in range(1,i+1):
4) print(num-i+j-1,end=" ")
5) print()
6) for a in range(1,num+1):
7) for k in range(0,num-a):
8) print(k+a,end=" ")
9) print()

4
34
234
1234
01234
1234
234
34
4

Pattern-62:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) for j in range(1,i+1):
4) print(chr(65+num-i),end=" ")
5) print()
6) for a in range(1,num+1):
7) for k in range(0,num-a):
8) print(chr(65+a),end=" ")
9) print()

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
25  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
E
DD
CCC
BBBB
AAAAA
BBBB
CCC
DD
E

Pattern-63:
1) for i in range(1,num+1):
2) for j in range(1,i+1):
3) print(chr(65+num-j),end=" ")
4) print()
5) for a in range(1,num+1):
6) for k in range(num-a,0,-1):
7) print(chr(64+k+a),end=" ")
8) print()
9) num=int(input("Enter a number:"))

E
ED
EDC
EDCB
EDCBA
EDCB
EDC
ED
E

Pattern-64:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) for j in range(1,i+1):
4) print(chr(64+num-i+j),end=" ")
5) print()
6) for a in range(1,num+1):
7) for k in range(1,num-a+1):
8) print(chr(64+k+a),end=" ")
9) print()

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
26  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
E
DE
CDE
BCDE
ABCDE
BCDE
CDE
DE
E

Pattern-65:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print("*",end=" ")
6) print()

*
**
***
****
*****

Pattern-66:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print(i,end=" ")
6) print()

1
22
333
4444
55555

Pattern-67:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
27  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
4) for j in range(1,1+i):
5) print(j,end=" ")
6) print()

1
12
123
1234
12345

Pattern-68:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,1+i):
5) print(chr(64+i),end=" ")
6) print()

A
BB
CCC
DDDD
EEEEE

Pattern-69:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,1+i):
5) print(chr(64+j),end=" ")
6) print()

A
AB
ABC
ABCD
ABCDE

Pattern-70:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
28  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
5) print("*",end=" ")
6) print()

*****
****
***
**
*

Pattern-71:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):
5) print(num-i+1,end=" ")
6) print()

55555
4444
333
22
1

Pattern-72:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):
5) print(num+2-i-j,end=" ")
6) print()

54321
4321
321
21
1
Pattern-73:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):
5) print(chr(65+num-i),end=" ")
6) print()

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
29  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
EEEEE
DDDD
CCC
BB
A

Pattern-74:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):
5) print(chr(65+num+1-i-j),end=" ")
6) print()

EDCBA
DCBA
CBA
BA
A

Pattern-75:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+2-i):
5) print(chr(64+j),end=" ")
6) print()

ABCDE
ABCD
ABC
AB
A

Pattern-76:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print("*",end=" ")
6) print()
7) for p in range(1,num):
8) print(" "*p,end="")

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
30  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
9) for q in range(1,num+1-p):
10) print("*",end=" ")
11) print()

*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*

Pattern-77:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print(i,end=" ")
6) print()
7) for p in range(1,num):
8) print(" "*p,end="")
9) for q in range(1,num+1-p):
10) print(num-p,end=" ")
11) print()

1
22
333
4444
55555
4444
333
22
1

Pattern-78:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print(j,end=" ")
6) print()
7) for p in range(1,num):

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
31  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
8) print(" "*p,end="")
9) for q in range(1,num+1-p):
10) print(q+p,end=" ")
11) print()

1
12
123
1234
12345
2345
345
45
5

Pattern-79:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print(j,end=" ")
6) print()
7) for p in range(1,num):
8) print(" "*p,end="")
9) for q in range(1,num+1-p):
10) print(q,end=" ")
11) print()

1
12
123
1234
12345
1234
123
12
1

Pattern-80:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print(chr(64+i),end=" ")
6) print()

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
32  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
7) for p in range(1,num):
8) print(" "*p,end="")
9) for q in range(1,num+1-p):
10) print(chr(64+num-p),end=" ")
11) print()

A
BB
CCC
DDDD
EEEEE
DDDD
CCC
BB
A

Pattern-81:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print(chr(64+j),end=" ")
6) print()
7) for p in range(1,num):
8) print(" "*p,end="")
9) for q in range(1,num+1-p):
10) print(chr(64+q+p),end=" ")
11) print()

A
AB
ABC
ABCD
ABCDE
BCDE
CDE
DE
E

Pattern-82:
1) n=int(input("Enter a number:"))
2) for i in range(1,n+1):
3) print(" "*(n-i),end="")
4) for j in range(1,i+1):
5) print(n-i+j,end=" ")

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
33  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
6) for k in range(2,i+1):
7) print(n+1-k,end=" ")
8) print()
9) for i in range(1,n+1):
10) print(" "*i,end="")
11) for j in range(1+i,n+1):
12) print(j,end=" ")
13) for k in range(2,n+1-i):
14) print(n+1-k,end=" ")
15) print()

5
454
34543
2345432
123454321
2345432
34543
454
5

Pattern-83:
1) while True:
2) n=int(input("Enter a number:"))
3) for i in range(1,n+1):
4) print(" "*(n-i),end="")
5) for j in range(1,i+1):
6) print(n+1-j,end=" ")
7) for k in range(2,i+1):
8) print(n-i+k,end=" ")
9) print()
10) for i in range(1,n+1):
11) print(" "*i,end="")
12) for j in range(1,n+1-i):
13) print(n+1-j,end=" ")
14) for k in range(2,n+1-i):
15) print(i+k,end=" ")
16) print()

5
545
54345
5432345
543212345
5432345
54345
545

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
34  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
5

Pattern-84:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(i,i+1):
5) print("*",end=" ")
6) if i>=2:
7) print(" "*(2*i-4),end="")
8) for k in range(i,i+1):
9) print("*",end=" ")
10) print()

*
**
* *
* *
* *

Pattern-85:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(i,i+1):
5) print(i,end=" ")
6) if i>=2:
7) print(" "*(2*i-4),end="")
8) for k in range(i,i+1):
9) print(i,end=" ")
10) print()

1
22
3 3
4 4
5 5

Pattern-86:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(i,i+1):

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
35  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
5) print(num+1-i,end=" ")
6) if i>=2:
7) print(" "*(2*i-4),end="")
8) for k in range(i,i+1):
9) print(num+1-i,end=" ")
10) print()

5
44
3 3
2 2
1 1

Pattern-87:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(i,i+1):
5) print(chr(64+num+1-i),end=" ")
6) if i>=2:
7) print(" "*(2*i-4),end="")
8) for k in range(i,i+1):
9) print(chr(64+num+1-i),end=" ")
10) print()

E
DD
C C
B B
A A

Pattern-88:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(i,i+1):
5) print(chr(64+i),end=" ")
6) if i>=2:
7) print(" "*(2*i-4),end="")
8) for k in range(i,i+1):
9) print(chr(64+i),end=" ")
10) print()

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
36  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
A
BB
C C
D D
E E

Pattern-89:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(i,i+1):
5) print("*",end=" ")
6) if i<=4:
7) print(" "*(2*num-2*i-2),end="")
8) for k in range(i,i+1):
9) print("*",end=" ")
10) print()

* *
* *
* *
**
*

Pattern-90:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(i,i+1):
5) print(i,end=" ")
6) if i<num:
7) print(" "*(2*num-2*i-2),end="")
8) for k in range(i,i+1):
9) print(i,end=" ")
10) print()

1 1
2 2
3 3
44
5

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
37  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
Pattern-91:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(i,i+1):
5) print(num-i+1,end=" ")
6) if i<=4:
7) print(" "*(2*num-2*i-2),end="")
8) for k in range(i,i+1):
9) print(num-i+1,end=" ")
10) print()

5 5
4 4
3 3
22
1

Pattern-92:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(i,i+1):
5) print(chr(64+num-i+1),end=" ")
6) if i<=4:
7) print(" "*(2*num-2*i-2),end="")
8) for k in range(i,i+1):
9) print(chr(64+num-i+1),end=" ")
10) print()

E E
D D
C C
BB
A

Pattern-93:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(i,i+1):
5) print(chr(64+i),end=" ")
6) if i<=4:

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
38  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
7) print(" "*(2*num-2*i-2),end="")
8) for k in range(i,i+1):
9) print(chr(64+i),end=" ")
10) print()

A A
B B
C C
DD
E

Pattern-94:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(i-1),end="")
4) for j in range(1,num+1):
5) print("*",end=" ")
6) print()

*****
*****
*****
*****
*****

Pattern-95:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(num-i),end="")
4) for j in range(1,i+1):
5) print("*",end=" ")
6) print(" "*(num-i),end="")
7) for k in range(1,i+1):
8) print("*",end=" ")
9) print()

* *
** **
*** ***
**** ****
**********

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
39  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
Pattern-96:
1) n=int(input("Enter a number:"))
2) for i in range(1,n+1):
3) for j in range(1,i+1):
4) if (i%2!=0 and j%2!=0 )or(i%2==0 and j%2==0):
5) print("1",end=" ")
6) else:
7) print("0",end=" ")
8) print()

1
01
101
0101
10101
010101
1010101

Pattern-97:
1) num=int(input("Enter a number:"))
2) for i in range(1,num+1):
3) print(" "*(2*num-i+3),end="")
4) for j in range(1,i+1):
5) print("*",end=" ")
6) print()
7) for i in range(1,num+3):
8) print(" "*(2*num-i+1),end="")
9) for j in range(-1,i+1):
10) print("*",end=" ")
11) print()
12) for i in range(1,num+5):
13) print(" "*(2*num-i),end="")
14) for j in range(-2,i+1):
15) print("*",end=" ")
16) print()
17) for i in range(1,num+3):
18) print(" "*((2*num)),end="")
19) print("* "*3)

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
40  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
*
**
***
****
***
****
*****
******
*******
********
****
*****
******
*******
********
*********
**********
***********
***
***
***
***
***
***

Pattern-98:
1) num=int(input("Enter a number"))
2) for i in range(1,num+1):
3) print(" "*(2*num-i),end="")
4) for j in range(1,i+1):
5) print("*",end=" ")
6) print()
7) for i in range(1,num+1):
8) print(" "*(num-i),end="")
9) for j in range(1,i+1):
10) print("*",end=" ")
11) print(" "*(num-i),end="")
12) for k in range(1,i+1):
13) print("*",end=" ")
14) print()

*
**
***
****
*****
* *

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
41  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
** **
*** ***
**** ****
**********

Pattern-99:
1) n=int(input("Enter a number"))
2) for i in range(1,2*n+1):
3) if i%2==0:
4) print("*"*i,end=" ")
5) else:
6) print("*"*(i+1),end=" ")
7) print()

**
**
****
****
******
******
********
********
**********
**********

Pattern-100:
1) n=int(input("Enter a number:"))
2) for a in range(1,n+1,2):
3) for i in range(1,n+1):
4) print(" "*(2*n-i-a),end="")
5) for j in range(1,i+a):
6) print("*",end=" ")
7) print()
8) for b in range(1,n+1):
9) print(" "*(n-2),end="")
10) print("* "*3)

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
42  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
*
**
***
****
*****
******
*******
********
***
****
*****
******
*******
********
*********
**********
*****
******
*******
********
*********
**********
***********
************
*******
********
*********
**********
***********
************
*************
**************
***
***
***
***
***
***
***
***

nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
43  040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com

You might also like