Dremendo Tag Line

Pattern printing program 54321 4321 321 using for loop in Python

for Loop - Question 15

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

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

54321
4321
321
21
1

Program

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

Output

54321
4321
321
21
1
video-poster