title: Python scope: "UnboundLocalError: local variable 'c' referenced before assignment"
body: <p>I am trying to figure out this:</p>
  
  <pre><code>c = 1
  def f(n):
      print c + n 
  def g(n):
      c = c + n
  
  f(1) # =&gt; 2
  g(1) # =&gt; UnboundLocalError: local variable 'c' referenced before assignment
  </code></pre>
  
  <p>Thanks!</p>