input: Write a function to generate the first n elements of the Sierpinski triangle in Python. If the input number n is less than or equal to 0, return an empty list.
  assert sierpinski_triangle(6) == [1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
  assert sierpinski_triangle(0) == []
  assert sierpinski_triangle(3) == [1, 1, 0, 1, 0, 0, 1]
  assert sierpinski_triangle(-5) == []
output: def sierpinski_triangle(n):
      if n <= 0:
          return []
      result = [1]
      for i in range(1, n):
          new_row = result[-1]
          for j in range(len(result) - 1):
              new_row = new_row * 2 + (result[j] ^ result[j + 1])
          result.append(new_row)
      return result