title: Python recursive function that retain variable values
body: <p>I am brushing up a bit of good old algorithms, and doing it with python, since I use it more often nowadays.</p>
  
  <p>I am facing an issue when running a recursive function; where the variable get reset every time that the recursive function call itself:</p>
  
  <pre><code>def recursive_me(mystring):
      chars = len(mystring)
      if chars is 0:
          print("Done")
      else:
          first = int(str[0])
          total = + first
          print(total)
          recursive_me(mystring[1:])
  
  recursive_me("4567")
  </code></pre>
  
  <p>What I am doing here is to get a string made of digits; take the first, convert it to an int; and run recursively the function again, so I can take one digit at time from the string and sum all the values.</p>
  
  <p>Ideally the output should show the total, while it add all the digits (4+5+6+7), although when the recursive function is called the first time, the function reset the total value.</p>
  
  <p>Is common habit to use global variables when running operations with recursive functions or am I doing something wrong?</p>