title: Call function without resetting variables
body: <p>I am making a card game, when it gets to the end I want people to be able to play more rounds but when it replays it must go through the variables again.. resetting the score. I am looking for a way to fix it without a whole new block of complicating code, I'm hoping I'm just missing a really easy fix.</p>
  
  <pre><code>#!/usr/bin/python
  # -*- coding: utf-8 -*-
  # Imports
  
  import time
  
  
  def play_game():
  
      # Variables
  
      acard = int()
      bcard = int()
      apoints = int()
      bpoints = int()
  
      # Repeat
  
      repeat = True
  
      # Hand out cards
  
      print 'Cards have been served'
      input('\nPress Enter to Reveal')
  
      # Cards Turn
  
      time.sleep(0.5)
      t = time.time()
      acard = int(str(t - int(t))[2:]) % 13
      print '\nYour card value is ' + str(acard)
  
      time.sleep(0.1)
  
      t = time.time()
      bcard = int(str(t - int(t))[2:]) % 13
  
      # Number Check &amp; Point Assign
  
      time.sleep(2)
      if acard &gt; 5:
          apoints += 1
          print '\nYour points have increased by one, your total is now ' \
              + str(apoints)
      if acard &lt; 5:
          apoints -= 1
          print '\nYour points have decreased by one, your total is now ' \
              + str(apoints)
      if bcard &gt; 5:
          bpoints += 1
          print '\nYour opponent got ' + str(bcard) \
              + ', their points have increased by one,\ntheir total is now ' \
              + str(bpoints)
      if bcard &lt; 5:
          bpoints -= 1
          print '\nYour opponent got ' + str(bcard) \
              + ', their points have decreased by one,\ntheir total is now ' \
              + str(bpoints)
  
      # Card Reset
  
      bcard = 0
      acard = 0
  
      # Shuffle
  
      input('\nPress enter to shuffle deck')
      print '\nCards being shuffled'
      time.sleep(1)
      print '.'
      time.sleep(1)
      print '.'
      time.sleep(1)
      print '.'
      print 'Cards have been shuffled'
      global enda
      global endb
      enda = apoints
      endb = bpoints
  
  
  # Loop
  
  time.sleep(1)
  answer = 'y'
  while answer.lower() == 'y':
      play_game()
      answer = input('\nDo you wish to play again? (Y/N)')
  
  # Scores
  
  if enda &gt; endb:
      print '\nYou Win!'
      print '\nScores'
      print 'You: ' + str(enda) + ' Opponent: ' + str(endb)
  
  if endb &gt; enda:
      print '\nYou Lost!'
      print '\nScores'
      print 'You: ' + str(enda) + ' Opponent: ' + str(endb)
  </code></pre>