from collections import defaultdict
from employees import read_csv

emps = read_csv('emps.csv')
ilosci = defaultdict(int)
sumy = defaultdict(float)

for emp in emps:
    sumy[emp.job_title] += emp.salary
    ilosci[emp.job_title] += 1

for job in sumy.keys():
    suma = sumy[job]
    ilosc = ilosci[job]
    srednia = suma / ilosc
    print(f'| {job:32} | {ilosc:2} | {srednia:8.2f} |')
