baseFileName = 'data_hops_bucket-'
fileIdx = ['1_1', '3_1', '6_1', '11_1', '19_1', '1_2', '3_2', '6_2', '11_2', '19_2']
fOut = 'Summary.txt'

list = {}
for i in fileIdx:
    idx = 0
    fName = baseFileName + i + '.txt'
    fdIn = open(fName, 'r')
    for line in fdIn:
        tmp = line.split()
        if idx in list: list[idx].append(float(tmp[1]))
        else: list[idx] = [float(tmp[1])]
        idx += 1
    fdIn.close()

fdOut = open(fOut, 'w')
for i in list:
    for j in list[i]: fdOut.write(str(round(j, 4)) + '\t')
    fdOut.write(str(sum(list[i])/len(list[i])) + '\n')
fdOut.close()
