title: Python: How to reset the list to original value inside the for loop for every iteration?
body: <p>I'm trying to pop every values one by one from a list in order to find the min and max sum. While doing that I'm resetting the list to its original value after every iteration, but it doesn't seems to be working...</p>
  
  <pre><code>a=[1,2,3,4,5]
  res=[]
  for i in range(len(a)):
      #print(a)
      lst=a
      #print(lst)
      lst.pop(i)
      print(lst)
      res.append(sum(lst))
  print(min(res))
  print(max(res))
  
  [2, 3, 4, 5]
  [2, 4, 5]
  [2, 4]
  ---------------------------------------------------------------------------
  IndexError                                Traceback (most recent call last)
  &lt;ipython-input-33-42daa1037d37&gt; in &lt;module&gt;
        5     lst=a
        6     #print(lst)
  ----&gt; 7     lst.pop(i)
        8     print(lst)
        9     res.append(sum(lst))
  
  IndexError: pop index out of range
  </code></pre>
  
  <p>I'm resetting the "lst" to "a" after every iteration, but its not working as expected. </p>
  
  <p>Expected result:</p>
  
  <pre><code>[2, 3, 4, 5]
  [1, 3, 4, 5]
  [1, 2, 4, 5]
  [1, 2, 3, 5]
  [1, 2, 3, 4]
  10
  14
  </code></pre>
  
  <p>Any help would be appreciated!</p>