title: Variable scoping when reassigning/changing global variable
body: <p>I'm running into behavior in python which I'm sure is easily explained but still peculiar to me. I can run a function that attempts to "change" a global variable but does not succeed because the variable created is local:</p>
  
  <pre><code>x = 'n'
  
  def make_up(letter):
      return letter.upper()
  
  
  print x
  &gt;&gt;&gt; 'n'
  print make_up(x)
  &gt;&gt;&gt; 'N'
  print x
  &gt;&gt;&gt; 'n'
  </code></pre>
  
  <p>However, if I run a function where I modify a list that is accessed from the global scope, the global variable is changed:</p>
  
  <pre><code>x = [0,1]
  
  def rem(lst):
     return lst.pop(0)
  
  print x
  &gt;&gt;&gt; [0,1]
  print rem(x)
  &gt;&gt;&gt; 0
  print x
  &gt;&gt;&gt; [1]
  </code></pre>
  
  <p>What is the explanation for this behavior? In other words: why am I able to modify a list from the global scope, but the string modified locally is left untouched in the global scope? </p>