title: Calculating average grade using functions and lists in Python 3.6
body: <p>What I'm trying to do is to make a list of names and grades based on user input, and then to show the list as well as to organize the list in a table, and finally to compute the average grade.</p>
  
  <p>So I want my script to prompt the user to input a name and a grade, and then store them in a list. This prompt will be repeated until the user enter an empty string (just press enter while prompted to enter a name).</p>
  
  <p>I have a problem storing the list, and initiating the printing and calculation when empty string is entered.</p>
  
  <p>Here is what I got so far: </p>
  
  <pre><code>    #   Importing Python tabulate package
  from tabulate import tabulate
  
  #   Defining functions
  def getRec():
      #   Get a record from user input, return an empty of the user entered an empty string as input
      name = str(input("Enter a name: "))
      if name != "":
          score = int(input("Enter the grade of " + name +": "))
          return name,score
      else:
          return None
  
  def addList(List,rec):
      #   Add a rec into the list
      List = tuple(rec)
      return List,rec
  
  def putRec(List):
      #   Print a record in a specific format
      print(List)
  
  def printTable(List):
      #   Print a table with a heading
      print(tabulate(List,showindex="always",headers=["Index","Name","Grade"]))
  
  def average(List):
      #   Computes the average score and return the value
      total = List[0][1]
      avg = total/len(List)
      print("Average Grade: ",avg)
  
  #   Main function
  
  List = []
  rec = []
  while True:
      rec = list(getRec())
      List = addList(List,rec)
  
      if rec == None:
          for index in range(len(List)):
              print()
              putRec(List)
              print()
              printTable(List)
              print()
              average(List)
          break
  </code></pre>
  
  <p>When I try to initiate the printing and calculation, there's an error because I returned a 'None' on my first function. But if I return zeros, the list became zeros. I need help trying to initiate my other functions and perhaps fixing how I create my list based on the inputs.</p>
  
  <p>Any help is appreciated. Thanks in advance.</p>