You are on page 1of 19

Pattern 1:

***

*****

*******

*********

***********

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

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

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

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

---------------------------- ------------------------------------
Program 1:

r = 1

while r <= 10:

sp = 10

while sp > r:

print(' ',end='')

sp -= 1

lc = 1

while lc <= r:

print('*',end='')

lc += 1

rc = 1

while rc < r:

print('*',end='')

rc += 1

print()

r += 1
Pattern 2:

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

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

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

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

***********

*********

*******

*****

***

----------------------------------------------------------------------------------------------

Program 2:

r = 10

while r >= 1:

sp = 9

while sp >= r:

print(' ',end='')

sp -= 1

lc = 1

while lc <= r:

print('*',end='')

lc += 1

rc = 1

while rc < r:

print('*',end='')

rc += 1

print()

r -= 1
Pattern 3:

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

-------------------------------------------------------- ----------
Program 3:

r = 1

while r <= 10:

sp = 10

while sp > r:
print(' ',end='')
sp -= 1
lc = 1
while lc <= r:
print('*',end='')
lc += 1

rc = 1

while rc < r:
print('*',end='')
rc += 1

print()

r += 1
r = 9

while r >= 1:

sp = 9

while sp >= r:
print(' ',end='')
sp -= 1

lc = 1

while lc <= r:
print('*',end='')
lc += 1

rc = 1

while rc < r:
print('*',end='')
rc += 1

print()

r -= 1
Pattern 4:

1
121
12321
1234321
123454321
12345654321
1234567654321
123456787654321
12345678987654321

----------------------------------- ---------------------
Program 4:
row = 1

while row < 10:

sp = 9

while sp > row:


print(' ',end='')
sp -= 1

l = 1

while l <= row:


print(l,end='')
l += 1

r = row - 1

while r >= 1:
print(r,end='')
r -= 1

print()

row += 1
Pattern 5:

12345678987654321
123456787654321
1234567654321
12345654321
123454321
1234321
12321
121
1
Program 5:

row = 9

while row >= 1:

sp = 9

while sp > row:


print(' ',end='')

sp -= 1

l = 1
while l <= row:
print(l,end='')

l += 1

r = row - 1

while r >= 1:
print(r,end='')

r -= 1

print()
row -= 1
Pattern 6:

1
121
12321
1234321
123454321
12345654321
1234567654321
123456787654321
12345678987654321
123456787654321
1234567654321
12345654321
123454321
1234321
12321
121
1
Program 6:

row = 1

while row <= 9:

sp = 9

while sp > row:


print(' ',end='')
sp -= 1

l = 1

while l <= row:


print(l,end='')
l += 1

r = row - 1

while r >= 1:
print(r,end='')
r -= 1

row += 1
print()
row = 8

while row >= 1:

sp = 8

while sp >= row:


print(' ',end='')

sp -= 1

l = 1

while l <= row:


print(l,end='')
l +=1

r = row - 1

while r > 0:
print(r,end='')

r -= 1

print()

row -= 1
Pattern 7:

1
212
32123
4321234
543212345
65432123456
7654321234567
876543212345678
98765432123456789
Program 7:

row = 1

while row <= 9:

sp = 9

while sp > row:


print(' ',end='')
sp -= 1

l = row

while l >= 1:
print(l,end='')
l-=1

r = 2

while r <= row:


print(r,end='')
r += 1

row += 1

print()
Pattern 8:

98765432123456789
876543212345678
7654321234567
65432123456
543212345
4321234
32123
212
1
Program 8:

row = 9

while row >= 1:

sp = 9

while sp > row:


print(' ',end='')
sp -= 1

l = row

while l >= 1:
print(l,end='')
l -=1

r = 2

while r <= row:


print(r,end='')
r += 1

row -= 1
print()
Pattern 9:

1
212
32123
4321234
543212345
65432123456
7654321234567
876543212345678
98765432123456789
876543212345678
7654321234567
65432123456
543212345
4321234
32123
212
1
Program 9:

row = 1

while row <= 9:

sp = 9

while sp > row:


print(' ',end='')
sp -= 1

l = row

while l >= 1:
print(l,end='')
l-=1

r = 2

while r <= row:


print(r,end='')
r += 1

row += 1

print()
row = 8

while row >= 1:

sp = 8

while sp >= row:


print(' ',end='')
sp -= 1

l = row

while l >= 1:
print(l,end='')
l -=1

r = 2

while r <= row:


print(r,end='')
r += 1

row -= 1
print()

You might also like