input: Write a function to generate the first n elements of the Sierpinski triangle in Python. The function should take an integer n as input and print the pattern as shown in the provided output.
  def sierpinski_triangle(n): 
      for i in range(2**n): 
          print(' ', end=" ") 
      for i in range(1, n+1): 
          for j in range(2**(i-1), 2**i): 
              print('1', end=" ") 
          print() 
          if i > 1: 
              for j in range(2**(i-1)+1, 2**i-1):  
                  print('0', end=" ") 
              print() 
          
  sierpinski_triangle(6)
  assert sierpinski_triangle(6) == None
output: def sierpinski_triangle(n):
      for i in range(n):
          print(" " * (2**n - 2**i), end="")
          for j in range(2**i):
              print("1", end=" " * (2**(n-i) - 1))
          print()