Advertisement
homeworkhelp111

Code

Nov 16th, 2021
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. def display_average(students):
  2.     for student in students:
  3.         score = 0
  4.         count = 0
  5.         for i in range(1, len(students[student])):
  6.             score = score + students[student][i]
  7.             count += 1
  8.         print(f'Average of {students[student][0]} is {score/count}')
  9.        
  10. def main():
  11.    students = { 'CCU101': ['Anna', 88.5, 98.5, 78, 85, 92.5],
  12.    'CCU102': ['Alex', 98,91,90,92,88],
  13.    'CCU103': ['Bob', 99.5, 98.5, 96, 96, 89.5],
  14.    }
  15.    display_average(students)
  16.  
  17. if __name__=='__main__':
  18.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement