Left Half-Pyramid Pattern Using Python

Code :

#Left Half-Pyramid Pattern Using Python www.codewithcurious.com
def pattern(rows):
   k = 2 * rows - 2
   for i in range(0, rows):
      for j in range(0, k):
         print(end=" ")
      k = k - 2
      for j in range(0, i + 1):
         print("* ", end="")
      print("\r")
rows = 7
pattern(rows)

Output :

Leave a Comment

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