title: Why does my recursive function return None?
body: <p>I have this function that calls itself:</p>
  
  <pre><code>def get_input():
      my_var = input('Enter "a" or "b": ')
  
      if my_var != "a" and my_var != "b":
          print('You didn\'t type "a" or "b". Try again.')
          get_input()
      else:
          return my_var
  
  print('got input:', get_input())
  </code></pre>
  
  <p>Now, if I input just "a" or "b", everything works fine:</p>
  
  <pre class="lang-none prettyprint-override"><code>Type "a" or "b": a
  got input: a
  </code></pre>
  
  <p>But, if I type something else and then "a" or "b", I get this:</p>
  
  <pre class="lang-none prettyprint-override"><code>Type "a" or "b": purple
  You didn't type "a" or "b". Try again.
  Type "a" or "b": a
  got input: None
  </code></pre>
  
  <p>I don't know why <code>get_input()</code> is returning <code>None</code> since it should only return <code>my_var</code>. Where is this <code>None</code> coming from and how do I fix my function?</p>