input: 
  def sierpinski_triangle(n): 
      """
      Generate the first n elements of the Sierpinski triangle.
      >>> sierpinski_triangle(1)
      1 
      >>> sierpinski_triangle(2)
      1 
      1 1
      >>> sierpinski_triangle(3)
      1 
      1 1
      1 0 1
      """
      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()
  
output:     result = [1]
      for i in range(1, n):
          new_row = [1]
          for j in range(1, i):
              new_row.append(result[i-1][j-1] + result[i-1][j])
          new_row.append(1)
          result.append(new_row)
      
      for row in result:
          print(' '.join(map(str, row)))