pattern program in python

Posted by Paidboom - 1 year ago

pattern program in python : Programs for printing pyramid patterns in Python

def getPattern(n):
    for i in range(0, n):
        for j in range(0, i+1):
            print("* ",end="")
        print("\r")
total = 10
getPattern(total)

Results:

* 
* * 
* * * 
* * * * 
* * * * * 
* * * * * * 
* * * * * * * 
* * * * * * * * 
* * * * * * * * * 
* * * * * * * * * *