Practice problem on loops

Write a program to use for loop to print the following reverse number pattern

5 4 3 2 1
4 3 2 1
3 2 1
2 1
1

4 Likes

Write a program to use for loop to print the following reverse number pattern

for i in range(5,0,-1):
for j in range(i,0,-1):
print(j,end=" ")
print()

Output:
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
1 Like

program to use for loop to print the following reverse number pattern

rows = int(input('Enter maximum columns or rows: ‘))
for i in range(0, rows + 1):
for j in range(rows - i, 0, -1):
print(j, end=’ ')
print()

n = 5

for i in range(n, 0, -1):
for j in range(i, 0, -1):
print(j, end=" ")
print()

1 Like

number = 5
for i in range(n,0,-1):
for j in range(i,0,-1):
print( j, end=" " )
print()

1 Like

vals = “”
for num in range(5, 0, -1):
vals = “”
for nums in range(num, 0, -1):
vals += str(nums)
print(int(vals))

Good, keep practicing

good, keep practicing

good, keep practicing

Good try, but please try to run it on compiler, Find the mistakes you have done