prabhavms

Q3(cyclesheet 6)

Dec 24th, 2021 (edited)
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. def student_marks(a):
  2.     mean = 0
  3.     exact_mean = []
  4.     above_mean = []
  5.     below_mean = []
  6.     for key in a:
  7.         mean= mean + a[key]
  8.     mean = (int)(mean/len(a))
  9.     for key in a:
  10.         if (a[key]==mean):
  11.             exact_mean.append(key)
  12.         elif (a[key]>mean):
  13.             above_mean.append(key)
  14.         else:
  15.             below_mean.append(key)
  16.     for i in exact_mean:
  17.         if i != None:
  18.             print(i)
  19.     for i in above_mean:
  20.         if i != None:
  21.             print(i)
  22.     for i in below_mean:
  23.         if i != None:
  24.             print(i)
  25. marks = eval(input())
  26. student_marks(marks)
Add Comment
Please, Sign In to add comment