soberfish

average finder

Mar 4th, 2021 (edited)
456
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. display = {}
  2.  
  3. def getAverage(list):
  4.     count = 0
  5.     for x in list:
  6.         count = count + x
  7.     return count/len(list)
  8.    
  9. students = int(input("How many students will you be recording? "))
  10.  
  11. for a in range(1, students+1):
  12.     name = input("\nENTER STUDENT #" + str(a) + ": ")
  13.     n_grade = int(input("How many grades will you be recording for " + name + "? "))
  14.    
  15.     grades = []
  16.     for b in range(1, n_grade+1):
  17.         score = int(input("ENTER SCORE #" + str(b) + ": "))
  18.         grades.append(score)
  19.    
  20.     GPA = getAverage(grades)
  21.     display[name] = GPA
  22.  
  23. def printValues():
  24.     print("\nAVERAGES: ")
  25.     for k, v in display.items():
  26.         print(str(k) + ":" + str(round(v,2)))
  27. printValues()
  28.        
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×