input: Write a function to generate the first n elements of the Sierpinski triangle in Python. If the given n is 0, return an empty list.
  
  assert sierpinski_triangle(6) == [
      "      1      ",
      "     1 1     ",
      "    1   1    ",
      "   1 1 1 1   ",
      "  1       1  ",
      " 1 1     1 1 "
  ]
  assert sierpinski_triangle(0) == []
  assert sierpinski_triangle(1) == ["1"]
output: def sierpinski_triangle(n):
      if n == 0:
          return []
      result = ["1"]
      for i in range(1, n):
          prev = result[-1]
          new_row = ""
          for j in range(len(prev)):
              if j == 0:
                  new_row += "1"
              else:
                  new_row += "1" if prev[j] != prev[j-1] else " "
          result.append(new_row + "1")
      max_len = len(result[-1])
      return [row.center(max_len) for row in result]