input: Write a function to generate the first n elements of the Sierpinski triangle. The function should take an integer n as input and print the Sierpinski triangle pattern for the first n rows. If n is less than or equal to 0, the function should print an empty line.
  assert sierpinski_triangle(6)
  assert sierpinski_triangle(1)
  assert sierpinski_triangle(0)
  assert sierpinski_triangle(-1)
  assert sierpinski_triangle(3)
output: def sierpinski_triangle(n):
      if n <= 0:
          print()
          return
      
      triangle = ["*"]
      for i in range(n):
          print(" ".join(triangle).center(2**n * 2 - 1))
          next_row = []
          for j in range(len(triangle)):
              if j == 0:
                  next_row.append("*")
              else:
                  next_row.append("*" if triangle[j-1] == triangle[j] else " ")
          next_row.append("*")
          triangle = next_row