title: How can I print the mean of key values of a dictionary in Python?
body: <p><strong>Python Question:</strong></p>
  
  <p>I've been trying to get Python 3 to print the mean, sum/len of my dictionary.</p>
  
  <p>I've been looking at methods on stack overflow of how to find the mean of values in a dictionary but every time I try to do it using the keys of values in a dictionary I am riddled with errors. I was able to get the len to work but dividing it doesn't work.</p>
  
  <p>*TL:DR <em>How do I print the mean of values from a Dictionary? on the commented line.</em></p>
  
  <p>I have cleaned out my code and left an empty line to put in the correct code.</p>
  
  <pre><code>import operator
  "Dictionary"
  time = {
          'Kristian':19,
          'Alistair':27,
          'Chris':900,
          'Maxi':50, 
          'Jack':15,
          'Milk Man':1
          }
  print(time)
  print ("-------------------------------")
  "Printing the List"
  for xyz in time:
      print ("-------------------------------")
      print("\nStudent Name: ", xyz,"\n Time: ", time[xyz],"seconds\n")
  
  "Printing the Results"
  def results():
      print ("-------------------------------")
      print("\nThe Fastest Time is: ",(time[min(time, key=time.get)]),"seconds")
      print("\nThe Slowest Time is: ",(time[max(time, key=time.get)]),"seconds")
      print("\nNo. of Competitors: ",len(time))
  "//////////Here is where I want to print the mean score\\\\\\\\\\"
  
  results()
  
  "Adding to the Results"
  def question():
      person = input("\nPlease enter the student's name: ")
      secs = int(input("Please enter the student's time in seconds: "))
      print("The results you have added are:")
      print("\nStudent Name: ", person,"\n Time: ", secs,"seconds\n")
      sure = input("Are you sure? ").lower()
      if sure in ("no", "n", "nope"):
          question()
      else:
          time.update({person:secs})
          print("Student has been added successfully.")
          results()
  
  "Running the loop"
  question()
  </code></pre>