Dremendo Tag Line

Pattern printing program 1 21 321 using for loop in Python

for Loop - Question 14

In this question, we will see how to print the pattern 1 21 321... in Python programming using for loop. To know more about for loop click on the for loop lesson.

Q14) Write a program in Python to print the pattern given below using for loop.

1
21
321
4321
54321

Program

for r in range(1,6):
    for c in range(r,0,-1):
        print(c,end='')
    print()

Output

1
21
321
4321
54321
video-poster