title: How to fix this error while clearing subset sums?
body: <p>I'm working on a project which requires me to find sum partitions of a certain value(required_reduction). I have to clear the <code>total_parts</code> list from sublists if any which has any value other than 2. index of combs's sublists.</p>
  
  <pre><code>Example:
  required_reduction = 4 
  combs = [[2,1],[3,2]]
  total_parts = [[1,1,1,1],[1,1,2],[2,2],[1,3]]
  </code></pre>
  
  <p>I can't use <code>[1,3]</code> because it has "3" in it which is not a value contained in 2.elemnt of "combs" sublists which are 1 and 2. "partition" function was taken from stackoverflow, I'm trying to construct rest.</p>
  
  <pre><code>import numpy as np
  
  
  required_reduction = 16
  
  
  combs = [[2,4],[3,5],[4,8],[5,13],[8,15],[10,18]]
  
  
  def partition(number):
      answer = set()
      answer.add((number, ))
      for x in range(1, number):
          for y in partition(number - x):
              answer.add(tuple(sorted((x, ) + y)))
      return answer
  
  total_parts = partition(required_reduction)
  total_parts = list(total_parts)
  
  
  
  def applicable_partitions(total_partitions, combinations):
      selections = [0]
      for _ in range(0, len(combinations) - 1):
          selections.append(combinations[_][1])
      del selections[0]
      possible_partitions = np.array(np.zeros(1,int))
  
  
      for i in range(0, len(total_partitions)-1):
          for j in range(0, len(total_partitions[i]) -1):
              for k in range(0, len(selections)-1):
                  if total_partitions[i][j] == selections[k]:
                      continue
                  else:
                      total_partitions.remove(total_partitions[i])
  
      return total_partitions
  
  print(applicable_partitions(total_parts, combs))
  </code></pre>
  
  <p>I am getting this error : </p>
  
  <blockquote>
    <p>if total_partitions[i][j] == selections[k]:
    IndexError: tuple index out of range. </p>
  </blockquote>
  
  <p>Can someone see why ?</p>