1. Number Pattern - 1
rows = int(input("Enter the number of rows:")
for num in range(rows):
for i in range(0, num+1):
print(num, end=' ') # print number
# line after each row to display pattern correctly
print( )
Output :-
Enter the number of rows: 8
0
11
222
3333
4444
55555
666666
7777777
2. Number Pattern - 2
rows = int(input("Enter the number of rows:"))
for i in range(rows, 0, -1):
num = i
for j in range(0, i):
print(num, end=' ')
print(' ')
Output :-
Enter the number of rows: 8
88888888
7777777
666666
55555
4444
333
22
1
3. Number Pattern - 3 (Left)
rows = int(input("Enter the number of rows:"))
for row in range(1, rows+1):
for column in range(1, row + 1):
print(column, end=' ')
print(' ')
Output :-
Enter the number of rows: 8
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
4. Number Pattern - 4(Right)
rows = int(input("Enter the number of rows:"))
for row in range(0, rows+1):
num = 1
for j in range(rows, 0, -1):
if j > row:
print(' ', end=' ')
else:
print(num, end=' ')
num += 1
print( )
Output :-
Enter the number of rows: 8
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
5. Number Pattern - 5
rows = int(input("Enter the number of rows:"))
num = rows
for i in range(rows, 0, -1):
for j in range(0, i):
print(num, end=' ')
print( )
Output :-
Enter the number of rows: 8
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8
8 8 8 8 8 8
8 8 8 8 8
8 8 8 8
8 8 8
8 8
8
6. Number Pattern - 6
rows = int(input("Enter the number of rows:"))
b = 0
for i in range(rows, 0, -1):
b += 1
for j in range(1, i + 1):
print(b, end=' ')
print( )
Output :-
Enter the number of rows: 8
1 1 1 1 1 1 1 1
2 2 2 2 2 2 2
3 3 3 3 3 3
4 4 4 4 4
5 5 5 5
6 6 6
7 7
8
7. Number Pattern - 7
rows = int(input("Enter the number of rows:"))
for row in range(0, rows+1):
for column in range(row, 0, -1):
print(column, end=' ')
print( )
Output :-
Enter the number of rows: 8
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
8. Number Pattern - 8
rows = int(input("Enter the number of rows:"))
for i in range(0, rows+1):
for j in range(1, i-1):
print(j, end=' ')
for j in range(i-1, 0, -1):
print(j, end=' ')
print()
Output :-
Enter the number of rows: 8
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 5 6 5 4 3 2 1
1 2 3 4 5 6 7 6 5 4 3 2 1
9. Number Pattern - 9
rows = int(input("Enter the number of rows:"))
for i in range(0, rows):
for j in range(rows-1, i, -1):
print(j,' ', end='')
for l in range(i):
print(' ', end='')
for k in range(i + 1, rows):
print(k, ' ', end='')
print( )
Output :-
Enter the number of rows: 8
7 6 5 4 3 2 1 1 2 3 4 5 6 7
7 6 5 4 3 2 2 3 4 5 6 7
7 6 5 4 3 3 4 5 6 7
7 6 5 4 4 5 6 7
7 6 5 5 6 7
7 6 6 7
7 7
10. Number Pattern - 10
rows = int(input("Enter the number of rows:"))
LastEvenNumber = 2 * rows
evenNumber = LastEvenNumber
for i in range(1, rows+1):
evenNumber = LastEvenNumber
for j in range(i):
print(evenNumber, end=' ')
evenNumber -= 2
print( )
Output :-
Enter the number of rows: 8
16
16 14
16 14 12
16 14 12 10
16 14 12 10 8
16 14 12 10 8 6
16 14 12 10 8 6 4
16 14 12 10 8 6 4 2
11. Number Pattern - 11
currentNumber = 1
stop = 2
rows = int(input("Enter number of rows:")) # Rows you want in your pattern
for i in range(rows):
for column in range(1, stop):
print(currentNumber, end='')
currentNumber += 1
print( )
stop += 2
Output :-
Enter the number of rows: 8
1
234
56789
10111213141516
171819202122232425
2627282930313233343536
37383940414243444546474849
505152535455565758596061626364
12. Number Pattern - 12
rows = int(input("Enter the number of rows:"))
for i in range(rows, 0, -1):
for j in range(0, i + 1):
print(j, end=' ')
print( )
Output :-
Enter the number of rows: 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6
0 1 2 3 4 5
0 1 2 3 4
0 1 2 3
0 1 2
0 1
13. Number Pattern - 13
rows = int(input("Enter the number of rows:"))
for i in range(0, rows):
for j in range(0, i + 1):
print(i * j, end=(' '))
print()
Output :-
Enter the number of rows: 8
0
0 1
0 2 4
0 3 6 9
0 4 8 12 16
0 5 10 15 20 25
0 6 12 18 24 30 36
0 7 14 21 28 35 42 49
14. Number Pattern - 14
rows = int(input("Enter the number of rows:"))
i = 1
while i <= rows:
j = 1
while j <= i:
print((i * 2-1), end=' ')
j = j + 1
i = i + 1
print()
Output :-
Enter the number of rows: 8
1
3 3
5 5 5
7 7 7 7
9 9 9 9 9
11 11 11 11 11 11
13 13 13 13 13 13 13
15 15 15 15 15 15 15 15
0 Comments