title: recursive sum of all the digits in a number
body: <p>I am stuck in this exercise. </p>
  
  <p>Task:</p>
  
  <blockquote>
    <p>A digital root is the recursive sum of all the digits in a number. Given n, take the sum of the digits of n. If that value has more than one digit, continue reducing in this way until a single-digit number is produced. This is only applicable to the natural numbers.</p>
  </blockquote>
  
  <p>Here's how it works:</p>
  
  <p>digital_root(16)<br>
  1 + 6 = 7</p>
  
  <p>digital_root(942)<br>
  9 + 4 + 2 = 15 ... 1 + 5 =6</p>
  
  <p>My approach is here. Any tips on how to properly return correct value? I would appreciate any help.</p>
  
  <pre><code>def digital_root(n):
      answ = 0
      s = 0
      x = str(n)
  
      for i in range(0, len(x)):
          s = s + int(x[i])
      if len(str(s)) &gt; 1:
          digital_root(s)
      elif len(str(s)) == 1:
          answ = s # here is an answer
          return answ # answer is 2 but this one is not returning 2, why?
  
      return answ # here it returns answ=0, I want to return 2...
  
  print(digital_root(493193))
  </code></pre>