title: Python: convert str to int inside a recursive function
body: <p>I am learning about recursive functions and I have made a simple "<em>string to ASCII</em>" converter which returns the ASCII value of each character of a string.</p>
  
  <p>Here is what I have made so far:</p>
  
  <pre><code>def cod(n):
      if n == "":
          return "" 
      else:
          a = str(ord(n[0])) + cod(n[1:])
          return a
  </code></pre>
  
  <p>This works fine like this:</p>
  
  <pre><code>=&gt; cod('hello')
  =&gt; '104101108108111'
  </code></pre>
  
  <p>The problem is when I am trying to get an <code>int</code> as output instead of a <code>string</code>. I can't simply convert variable <code>a</code> because it's a recursive function, and it's not possible to iterate over an int.</p>
  
  <p>After this point I am a little lost, can someone point out how to get an int as a final result of this recursive function?</p>