title: Python recursion (format issue)
body: <blockquote>
  <p>Write a recursive function <code>replace_digit(n, d, r)</code> which replaces each occurrence of digit <code>d</code> in the number <code>n</code> by <code>r</code>.</p>
  <p><code>replace_digit(31242154125, 1, 0)</code> =&gt; <code>30242054025</code></p>
  </blockquote>
  <p>My code is as such</p>
  <pre><code>def replace_digit(n, d, r):
      y=str(n)
      if len(y)==0:
          return ''
      else:
          if y[0]== str(d):
              return str(r) + replace_digit(str(n)[1:],d,r)
          else:
              return y[0]+ replace_digit(str(n)[1:],d,r)
  </code></pre>
  <p>However, the answer I get is in a string format. Any idea how to convert into an integer format? I have been stuck for quite some time on this :(</p>