title: Simple program to find squre root using recursion
body: <p>Hi I'm new to Python and I wrote a simple program to find the square root of a given number.</p>
  
  <pre><code>n = int(input("ENTER YOUR NUMBER: "))
  g = n/2
  t = 0.0001
  
  def findRoot(x):
      if ((x * x &gt; n - t) and (x * x &lt;= n + t)):
          return x
      else:
          x = (x + n / x) / 2
          findRoot(x)
  r = findRoot(g)
  
  print("ROOT OF {} IS {}".format(n, r))
  </code></pre>
  
  <p><code>t</code> is the maximum error.</p>
  
  <p>I know it's easy to use a while loop but I can't figure out what's wrong with this code. I debugged the code and after returning the value <code>x</code> (line 7), line 10 runs again resulting a "None" value.</p>
  
  <p>Console output for any <code>n</code>, <code>n &gt; 0</code> (except 4) is <code>ROOT OF (Given Number) IS None</code></p>
  
  <p>Any idea how to correct the code?</p>