title: Why does my recursive function with if-elif statements return None?
body: <p>I'm currently trying to wrap my head around learning Python and I've come to a bit of a stall on recursive functions. In <a href="http://www.greenteapress.com/thinkpython/" rel="nofollow noreferrer">Think Python</a>, one of the exercises is to write a function that determines if number <em>a</em> is a power of number <em>b</em> using the following definition:</p>
  
  <blockquote>
    <p>"A number, a, is a power of b if it is divisible by b and a/b is a power of b. Write a function called is_power that takes parameters a and b and returns True if a is a power of b."</p>
  </blockquote>
  
  <p>The current state of my function is:</p>
  
  <pre><code>def isPower(a,b):
      return a % b == 0 and (a/b) % b == 0
  
  print isPower(num1,num2)
  </code></pre>
  
  <p>As it is, this produces the result I expect. However the chapter is focused on writing recursive functions to reduce redundancy and I'm not quite sure how I can turn the final "(a/b) % b == 0" into a recursion. I've attempted:</p>
  
  <pre><code>def isPower(a,b):
      if a % b != 0:
          return False
      elif isPower((a/b),b):
          return True
  </code></pre>
  
  <p>But that just returns None. </p>
  
  <p>What is the proper way to recurse this function?</p>