title: With a recursive function : RecursionError: maximum recursion depth exceeded while getting the str of an object
body: <pre><code>def sum_digits(n):
  
      if n &lt; 0:
          raise ValueError(&quot;The number must be higher or equal to 0&quot;)
      
      num = sum([int(i) for i in str(n)])
      
      if str(num) == 1:
          return num
      else:
          return sum_digits(num)
  </code></pre>
  <p>If I try <code>print(sum_digits(854))</code>, I got the following error:</p>
  <pre><code>RecursionError: maximum recursion depth exceeded while getting the str of an object
  </code></pre>
  <p>I tried to step into that code, but for me that code is perfectly legit. What's wrong with that code?</p>