input: Write a function to generate the first n elements of the Sierpinski triangle. The function should print the Sierpinski triangle in a binary pattern where '1' represents the filled part of the triangle and '0' represents the unfilled part. If n equal to 0, it should print an empty space. 
  
  def sierpinski_triangle(n): 
      if n == 0:
          print(' ', end=" ")
          return
      
      # Drawing lines for first row 
      for i in range(2**n): 
          print(' ', end=" ") 
      
      # loop for printing n rows 
      for i in range(1, n+1): 
          # bit pattern for first and 
          # last line of each row 
          for j in range(2**(i-1), 2**i): 
              print('1', end=" ") 
          print() 
          
          # inner rows have opposite bit pattern 
          if i > 1: 
              for j in range(2**(i-1)+1, 2**i-1):  
                  print('0', end=" ") 
              print() 
          
  sierpinski_triangle(6)
  sierpinski_triangle(0)
output: def sierpinski_triangle(n): 
      if n == 0:
          print(' ', end=" ")
          return
      
      triangle = ['0'] * (2**n)
      triangle[0] = '1'
      
      for i in range(1, n):
          for j in range(2**i, 2**(i+1)):
              triangle[j] = triangle[j - 2**i]
      
      for i in range(2**n):
          if triangle[i] == '1':
              print('1', end=" ")
          else:
              print('0', end=" ")
          if i+1 == 2**(n-1):
              print()