title: Function to gather user input on basic coin flip guessing program not behaving as expected
body: <p>Total newbie here with only a few weeks of experience. I'm trying to code a simple coin flip guessing game. I've done it before solely using if statements and while loops, but I really want to try and do it using functions to push my understanding of python.</p>
  <p>Below is the first function I wrote, which is meant to collect the user's guess. I put the print() statement in to confirm it's working properly.</p>
  <p>My problem is that when I execute this code and enter &quot;h&quot;, &quot;t&quot;, or &quot;q&quot; as input, the function will loop once, only print out the result on the second loop, and then it will exit. The &quot;else&quot; statement seems to work fine.</p>
  <p>For the life of me, I can't figure out why it is looping at all, and why it is only printing the result on the second loop. Any guidance is appreciated.</p>
  <pre><code>import random
  print(&quot;Welcome to the coin flipper!&quot;)
  def guess_gathering():
    user_guess = input(&quot;Pick [h]eads, [t]ails, or [q]uit:&quot;)
    if user_guess == &quot;h&quot;:
      return 1
    elif user_guess == &quot;t&quot;:
      return 2
    elif user_guess == &quot;q&quot;:
      return &quot;q&quot;
    else:
      print(&quot;Invalid selection!&quot;)
      guess_gathering()
  guess_gathering()
  print(guess_gathering())
  </code></pre>