Learn practical skills, build real-world projects, and advance your career
Updated 3 years ago
1) Pattern 1:
5 5 5 5 5
5 5 5 5
5 5 5
5 5
5
n=int(input("enter number of rows: "))
for i in range(0,n+1):
for j in range(0,n-i):
print('5',end=' ')
print()
enter number of rows: 5
5 5 5 5 5
5 5 5 5
5 5 5
5 5
5
2) Pattern 2:
0 1 2 3 4 5
0 1 2 3 4
0 1 2 3
0 1 2
0 1
n=int(input("enter number of rows: "))
for i in range(n,0,-1):
for j in range(0,i+1):
print(j , end=' ')
print()
enter number of rows: 5
0 1 2 3 4 5
0 1 2 3 4
0 1 2 3
0 1 2
0 1
3) Pattern 3:
1
3 3
5 5 5
7 7 7 7
9 9 9 9 9