title: Class instance variable is reduced when popping a different list in Python
body: <p>I am attempting the Probability Calculator from freecodecamp, which can be found <a href="https://repl.it/github/freeCodeCamp/boilerplate-probability-calculator" rel="nofollow noreferrer">Here</a></p>
  <p>In a class function to randomly select n items from a list, I access the contents of my list via <code>self.contents</code>, which is an instance variable for whatever hat filled with balls I make. My function looks as such:</p>
  <pre><code>def draw(self,num_balls_drawn):
    randomlist = []
    templist = self.contents
    if num_balls_drawn &lt;= len(templist):
      for x in range(num_balls_drawn):
        popped = templist.pop(random.randint(0, len(templist)-1)) # random has been imported
        randomlist.append(popped)
      return randomlist 
  
    else:
      return self.contents #If you ask for more items than there are in list, just returns list
  </code></pre>
  <p>Therefore, when I create a class instance using this code:</p>
  <pre><code>class Hat:
    def __init__(self,**kwargs):
      self.__dict__.update(kwargs)
      contents=[]
      for key in self.__dict__:
        for x in range(self.__dict__.get(key)):
          contents.append(key)
      self.contents= contents
  </code></pre>
  <p>And then create an instance with <code>hat = Hat(blue=4, red=2, green=6)</code>, then testing my functions with<code>print(hat.contents) print(hat.draw(7)) print(hat.contents) print(hat.draw(7))</code></p>
  <p>I would hope to be given a list of <code>['blue', 'blue', 'blue', 'blue', 'red', 'red', 'green', 'green', 'green', 'green', 'green', 'green']</code> for <code>hat.contents</code> and a list such as <code>['blue', 'blue', 'red', 'green', 'blue', 'blue', 'green']</code> for <code>hat.draw(7)</code></p>
  <p>However, on the second attempt of using these statements, I instead am returned <code>['blue', 'blue', 'green', 'green', 'green']</code> and
  <code>['blue', 'blue', 'green', 'green', 'green']</code></p>
  <p>Both of which are somehow a length of only 5.</p>
  <p>It seems despite setting up a temporary list <code>templist</code>,  my <code>self.contents</code> is still shortened everytime I pop an item out of <code>templist</code>.</p>
  <p>If anyone could offer a solution to my Issue that would be appreciated.</p>