fork download
  1. tests = int(input())
  2. for test in range(tests):
  3. [students, *score] = map(lambda s: int(s), input().split(' '))
  4. avg = sum(score) / students
  5. higher = len(list(filter(lambda x: x > avg, score)))
  6. print("{:.3f}%".format(higher/students * 100))
  7.  
Success #stdin #stdout 0.02s 9296KB
stdin
5
5 50 50 70 80 100
7 100 95 90 80 70 60 50
3 70 90 80
3 70 90 81
9 100 99 98 97 96 95 94 93 91
stdout
40.000%
57.143%
33.333%
66.667%
55.556%