input: Write a function to generate the first n elements of the Sierpinski triangle in Python. If the given number of elements n is 0, return an empty list.
  assert sierpinski_triangle(0) == []
  assert sierpinski_triangle(1) == ['1']
  assert sierpinski_triangle(2) == ['1', '1 1']
  assert sierpinski_triangle(3) == ['1', '1 1', '1 0 1']
  assert sierpinski_triangle(4) == ['1', '1 1', '1 0 1', '1 1 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) + 1):
              if j == 0 or j == len(prev):
                  new_row.append('1')
              else:
                  new_row.append('0' if prev[j-1] != prev[j] else '1')
          result.append(' '.join(new_row))
      return result