title: Average of a nested dictionary
body: <p>I have a nested dictionary for a grade-book program that looks like this(this is just an example, it could be any number of students or tests):</p>
  
  <pre><code>workDictionary = {'kevin': {'Test1': 97, 'Test2': 84, 'Test3': 89},
                    ''Bob':{'Test1': 67, 'Test2': 74, 'Test3': 59},
                    'carol':{'Test1': 47, 'Test2': 94, 'Test3': 79},
                    'ted':{'Test1': 67, 'Test2': 64, 'Test3': 99}}
  </code></pre>
  
  <p>And I want to get the average of the innermost values, for instance:</p>
  
  <pre><code>finalGrade = {}
  for k,v in workDictionary.iteritems():
      finalGrade[k] = sum(v)/ float(len(v))
  </code></pre>
  
  <p>There are other factors however, i'm using pickling and an undefined amount of students and tests. This is the full program:  </p>
  
  <pre><code># Modules
  import pickle
  
  def dumpPickle(fileName):
      pickle.dump(workDictionary, open(fileName,'wb'))
      return
  
  def loadUnPickle(fileName):
      global workDictionary
      workDictionary = pickle.load(open(fileName, 'rb'))
      return(workDictionary)
  
  workDictionary = {}
  keys = workDictionary.keys()
  values = workDictionary.values()
  
  def myMenu():
      mySelect = -1
      while mySelect != 0:
          print("\n1. Open Dictionary File\n"+
                "2. Create/Write to a Dictionary\n"+
                "3. Add a New Student\n"+
                "4. Find a Student's Scores\n"+
                "5. Add a New Student Score\n"+
                "6. Display Dictionary Data\n"+
                "0. Exit\n"
                )
          mySelect = int(input("Enter Menu Number: "))
          if mySelect == 1:
              fileName = input("Enter file name")
              print("\nyour file is now open")
              loadUnPickle(fileName)
  
          elif mySelect == 2:
              fileName = input("please create a new file.")
              print("\nyour new file is now open")
  
          elif mySelect == 3:
                  newStudent = input("Enter the new student's name")
                  firstTest = input("Enter the name of the first test")
                  testGrade = input("Enter the new student's first grade")
                  addDictionary = {newStudent:{firstTest:testGrade}}
                  workDictionary.update(addDictionary)
                  print("\n" + newStudent + str(workDictionary[newStudent]))
                  dumpPickle(fileName)
  
          elif mySelect == 4:
              print("\nEnter student name")
              myName = input()
              for name in workDictionary:
                  if name == myName:
                      print("\n",workDictionary.get(myName))
  
          elif mySelect == 5:
              print("\nEnter student name ")
              myName = input()
              print("\nEnter assignment to add or update")
              myValue = input()
              for name in workDictionary:
                  if name == myName:
                      newGrade = input("Enter new Grade")
                      workDictionary[name][myValue]= newGrade
                      dumpPickle(fileName)
                      print("\n" + name + str(workDictionary[name]))
          elif mySelect == 6:
              print(workDictionary)
      return
  
  # Main Loop
  </code></pre>
  
  <p>I want to add another menu selection that takes the average of a certain student and displays it.</p>