title: Passing Var data b/w functions
body: <p>Ok so I've searched the database, and read a few posts, but none of them seem to answer my question, at least in a way I understand.  First to premise, I'm new to Python, but have some experience in C# and some C++.  In these languages variables are "global" and you can only have one instance of them.  Now with python it seems you variables are local, and you can have multiple instances of a variable of same name.  For a program I'm having to write for school, I was told using global to pass data is bad practice (don't quite understand that thinking).  So I'm trying to pass data from first function to second function.  Code as written is using a global variable, however I'm trying to see how I would pass the data b/w them.</p>
  
  <pre><code>    #modules
  import time
  #variables
  
  testScores = []
  #avg = 0.0
  
  #functions
  def calculate_average():
      x = 0
      print("Enter test scores")
      while (x &lt;=4): #limits number of inputs to 5 test scores as required per instructions for lab
          test = input('Enter test score: ')
          #if test == "":
              #break
          x += 1
          testScores.append(float(test)) #adds input from test var into testScores list as a float
      time.sleep(1)
      print("","calculating average", ".........", "", sep = "\n")
      time.sleep(1)
      global avg #makes the var avg global so as to keep data stored so other functions can access the data
      avg = float(sum(testScores)/len(testScores))#takes all the data points stored in the list testScores and adds them up via sum ,and then divdes by (len)gth (aka number of data points)
      print("%.2f" % avg)#displays avg limiting to two decimal points rounding to the nearest 100th
  
  
  def determine_grade(): #fucntion calls the var avg (which was made global in function 1) and converts it into a letter grade.
      if (avg &gt;= 90.0 and avg &lt;= 100.0):
          print("Grade = A")
      elif (avg &gt;= 80.0 and avg &lt;= 89.9):
          print("Grade = B")
      elif (avg &gt;= 70.0 and avg &lt;= 79.9):
          print("Grade = C")
      elif (avg &gt;= 60.0 and avg &lt;= 69.9):
          print("Grade = D")
      elif (avg &lt;= 59.9):
          print("Grade = F")
  def main():
      print("Beginning Program","", sep = "\n")
      time.sleep(1)
      calculate_average()
      determine_grade()
      time.sleep(1)
      print("","End of program...", "Have a good day...", "Program Terminated", sep = "\n")
  
  main()
  </code></pre>
  
  <p>What I need help with is how I can take the value from the variable "avg" in calculate_average() and pass it to determine_grade().</p>