Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calc(scores):
- total = 0
- for i in scores:
- total += i
- avg = total / 3
- return total, round(avg, 2)
- score = [[76, 73, 85], [88, 84, 76], [92, 82, 92], [82, 91, 85], [72, 74, 73]]
- highest = 0
- highest_avg = 0
- class_total = 0
- _class_total = 0
- for i in range(len(score)):
- print('student', i+1)
- total, avg = calc(score[i])
- class_total += avg
- _class_total += total
- if avg > highest_avg:
- highest = i + 1
- highest_avg = avg
- for j in range(len(score[i])):
- print(' {}: {}'.format(j+1, score[i][j]))
- print(' sum: ', total)
- print(' avg: ', avg)
- print('total: {}, avg: {}'.format(_class_total, round(class_total/5, 2)))
- print('highest avg: student {}: {}'.format(highest, highest_avg))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement