title: How to use variables in multiple different functions in Python 3
body: <p>I define a variable named 'computerChoice' in a function and then attempt to use it in another variable but it says that 'computerChoice' is undefined... Being new to Python, I am not sure why this is happening so I hope that you could help answer my question!</p>
  
  <pre><code>def computerDecision():
              import random
              for x in range(1):
              num = random.randint(1,4)
              if num == 1:
                  computerChoice = 'rock'
              elif num == 2:
                  computerChoice = 'paper'
              elif num == 3:
                  computerChoice = 'scissors'
  
      def determineWinner():
          if userInput == computerChoice:
              print("You both chose " + computerChoice)
              print("DRAW!")
          elif userInput == 'rock' and computerChoice == 'paper':
              print("The computer chose " + computerChoice)
              print("COMPUTER WINS!")
          elif userInput == 'rock' and computerChoice == 'scissors':
              print("The computer chose " + computerChoice)
              print('USER WINS!')
          elif userInput == 'paper' and computerChoice == 'rock':
              print("The computer chose " + computerChoice)
              print("USER WINS!")
          elif userInput == 'paper' and computerChoice == 'scissors':
              print("The computer chose " + computerChoice)
              print("COMPUTER WINS!")
          elif userInput == 'scissors' and computerChoice == 'rock':
              print("The computer chose " + computerChoice)
              print("COMPUTER WINS!")
          elif userInput == 'scissors' and computerChoice == 'paper':
              print("The computer chose " + computerChoice)
              print("USER WINS!")
  </code></pre>