title: UnboundLocalError: local variable 'r' referenced before assignment
body: <p>I'm having an issue with variable and function. Here is a simple code:</p>
  
  <pre><code>r = 0
  list = ['apple','lime','orange']
  def list_list(x):
      for i in x:
          r +=1
          print r
  list_list(list)
  </code></pre>
  
  <h2>Error:</h2>
  
  <pre><code>UnboundLocalError: local variable 'r' referenced before assignment
  </code></pre>
  
  <p>I know it must be something simple. I started to do my script using functions instead straight code.</p>