1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Code:
n=5
for i in range(n):
for j in range(n):
print('*', end=' ')
print()
5
4 4
3 3 3
2 2 2 2
1 1 1 1 1
Code:
n = 5
for i in range(n):
for j in range(i+1):
print('*', end=' ')
print()
0
2 2
4 4 4
6 6 6 6
8 8 8 8 8
Code:
n=5
p=0
for i in range (n):
for j in range (i+1):
print (p, end = ' ')
p+=2
print()
1
2 2
1 1 1
2 2 2 2
1 1 1 1 1
Code:
n=5
for i in range (n):
for j in range (i+1):
if i%2 == 0:
print ('1', end = ' ')
else:
print ('2', end = ' ')
print()
1
2 2 2
3 3 3 3 3
4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5
6 6 6 6 6 6 6
7 7 7 7 7
8 8 8
9
Code:
n=5
p=1
for i in range (n1):
for j in range (i,n):
print (' ', end = ' ')
for j in range (i):
print (p, end = ' ')
for j in range (i+1):
print (p, end = ' ')
p+=1
print()
for i in range (n):
for j in range (i+1):
print (' ', end = ' ')
for j in range (i,n1):
print (p, end = ' ')
for j in range (i,n):
print (p, end = ' ')
p+=1
print()
1
2 2 2
3 3 3 3 3
4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5
4 4 4 4 4 4 4
3 3 3 3 3
2 2 2
1
Code:
n=5
p=1
for i in range (n1):
for j in range (i,n):
print (' ', end = ' ')
for j in range (i):
print (p, end = ' ')
for j in range (i+1):
print (p, end = ' ')
p+=1
print()
for i in range (n):
for j in range (i+1):
print (' ', end = ' ')
for j in range (i,n1):
print (p, end = ' ')
for j in range (i,n):
print (p, end = ' ')
p=1
print()
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Code:
n = 5
for i in range(n):
p=1
for j in range(i+1):
print(p, end=' ')
p+=1
print()
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Code:
n = 5
for i in range(n):
p=1
for j in range(i):
print(' ', end=' ')
for k in range(i, n):
print(p, end=' ')
p+=1
print()
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
Code:
n = 5
for i in range(n):
p=1
for j in range(i, n):
print(' ', end=' ')
for j in range(i):
print(p, end=' ')
p+=1
for j in range(i+1):
print(p, end=' ')
p+=1
print(' ')
5
5 4
5 4 3
5 4 3 2
5 4 3 2 1
Code:
n = 5
for i in range(n):
p=5
for j in range(i+1):
print(p, end=' ')
p=1
print()
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
Code:
n=5
k=5
for i in range (n):
p = k
for j in range (i+1):
print (' ', end = ' ')
for j in range (i,n):
print (p, end = ' ')
p=1
k=1
print()
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
Code:
n = 5
for i in range(n):
p=1
for j in range(i, n):
print(' ', end=' ')
for j in range(i):
print(p, end=' ')
p+=1
for j in range(i+1):
print(p, end=' ')
p=1
print()
1
2 3
4 5 6
7 8 9 10
Code:
n = 5
p=1
for i in range(n):
for j in range(i+1):
print(p, end=' ')
p+=1
print()
49 videos38 docs18 tests

49 videos38 docs18 tests


Explore Courses for Software Development exam
