title: Coin flip program that repeats based on "yes" or "no" response
body: <p>I'm very new to python and want to create a basic coin flip program that will repeat based on user input.
  I was able to create the randomized response for the coin flip but when it asks if I want to repeat it it dosn't generate a new randomized response and instead repeats the same response. how do i get it to restart the program if i input "y".</p>
  
  <pre><code>import random
  coin = random.randint(0,1)
  y = "y"
  n = "n"
  
  import sys
  def coin_flip():
      if coin == 0:
          print("Heads")
      elif coin == 1:
          print("tails")
      again = input("flip again?('y' or 'n') ")
      if again == y:
          coin_flip()
  
      else:
          again == n
          print("good bye")
          sys.exit()
  coin_flip()
  </code></pre>