Inverted Left triangle patterns in python

Inverted Left Triangle Pattern Type-1 (Source Code)

for x in range(0,5):

    for y in range(5,x,-1):

        print(“*”,end=” “)

    print(“”)

Output

* * * * *

* * * *

* * *

* *

*

Inverted Left Triangle Pattern Type-2 (Source Code)

for x in range(1,6):

    for y in range(6,x,-1):

        print(x,end=” “)

    print(“”)

Output

1 1 1 1 1

2 2 2 2

3 3 3

4 4

5

Inverted Left Triangle Pattern Type-3 (Source Code)

for x in range(1,6):

    for y in range(5,x-1,-1):

        print(y,end=” “)

    print(“”)

Output

5 4 3 2 1

5 4 3 2

5 4 3

5 4

5

Leave a Comment

Your email address will not be published. Required fields are marked *