Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jul 18th, 2018 55 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. def calc(scores):
  2.     total = 0
  3.     for i in scores:
  4.         total += i
  5.     avg = total / 3
  6.     return total, round(avg, 2)
  7.  
  8. score = [[76, 73, 85], [88, 84, 76], [92, 82, 92], [82, 91, 85], [72, 74, 73]]
  9. highest = 0
  10. highest_avg = 0
  11. class_total = 0
  12. _class_total = 0
  13. for i in range(len(score)):
  14.     print('student', i+1)
  15.     total, avg = calc(score[i])
  16.     class_total += avg
  17.     _class_total += total
  18.     if avg > highest_avg:
  19.         highest = i + 1
  20.         highest_avg = avg
  21.  
  22.     for j in range(len(score[i])):
  23.         print(' {}: {}'.format(j+1, score[i][j]))
  24.  
  25.     print(' sum: ', total)
  26.     print(' avg: ', avg)
  27. print('total: {}, avg: {}'.format(_class_total, round(class_total/5, 2)))
  28. print('highest avg: student {}: {}'.format(highest, highest_avg))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top