Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a, b = [], [[0 for i in range(1, 4)] for j in range(1, 12)]
- with open('file.txt') as file:
- for i in file:
- i = i.strip().split()
- a.append(i)
- for i in range(11):
- for j in range(len(a)):
- if int(a[j][0]) == i+1:
- b[i][0] += int(a[j][2])
- b[i][1] += 1
- for i in range(11):
- if b[i][1] == 0:
- b[i][2] = '-'
- else:
- b[i][2] = b[i][0]/b[i][1]
- for i in range(11):
- print(i+1, b[i][2])
Add Comment
Please, Sign In to add comment