title: Return in Recursive Function
body: <p>I have just started learning python (v3.2.3) and have encountered an odd problem about the <code>return</code> in this function:</p>
  
  <pre><code>def test(x):
      if x &gt; 9 :
          test(x - 10)
      else:
          print('real value',x)
          return x
  
  x = int(input())
  y = test(x)
  print('this should be real value',y)
  </code></pre>
  
  <p>When I run it, I get:</p>
  
  <pre><code>45
  real value 5
  this should be real value None
  </code></pre>
  
  <p>But I expected:</p>
  
  <pre><code>45
  real value 5
  this should be real value 5
  </code></pre>
  
  <p>I tried adding <code>return x</code> outside of <code>if</code> and I got the default input value.  Can anyone please explain how <code>return</code> works?</p>