Python program to print star patterns in python

Here is a python program to print different patterns in python.

Contents

First Pattern

#Printing patterns in python

for i in range(1,11):
    for j in range(i):
        print('*', end='')
    print()

# This code is contributed by Ahmad Shafiq

Output of first pattern

Second Pattern

#Printing patterns in python

for k in range(10,0,-1):
    for l in range(k):
        print('*', end='')
    print()

# This code is contributed by Ahmad Shafiq

Output of second pattern

Third Patten

#Printing patterns in python

for i in range(10, 0, -1):
    for j in range(1, 11-i):
        print(' ',end='')
    for k in range(1, i+1):
        print('*', end='')
    print()

# This code is contributed by Ahmad Shafiq

Output of third pattern

Fourth pattern

#Printing patterns in python

for i in range(1, 11):
    for j in range(1, 11-i):
        print(' ',end='')
    for k in range(1, i+1):
        print('*', end='')
    print()

# This code is contributed by Ahmad Shafiq

Output of fourth pattern

callout-flag

Love this read? Subscribe to Modernage!

Do you have any queries? You can ask in the comments. We, at Modernage answer each and every question, asked in the comments, so If you have any queries, or you want to know about any specific platform you can ask in the comments below

Author

Leave a Reply

girl-carrying-document

More Articles.

girl-carrying-document

More Articles.