title: How to change a variable value from within a function?
body: <pre><code>def Q1(score): #defines the first question
      print ("\n\n1) Question")
      print ("\nA) Option.")
      print ("\nB) Option")
      print ("\nC) Option.")
  
      ans = input("\nIs it A, B or C? ") #asks for the answer
  
      if ans.upper() == "B": #makes it uppercase if they entered lowercase
           print ("Correct!")
           score += 1 #adds one to the score
           return (score) #returns the score
  
  Q1(score) #function is called
  print (score) #score is printed
  </code></pre>
  
  <p>This is my code, no errors occur when I run it but when the "score" variable is returned the value is reset to 0, why? (Score is first defined above the first function, couldn't fit it in)</p>