I have a file like this: (Dots are some numbers that were used to calculate the average.)
Ashe: .....
Azok: .....
Bumba: .....
Thrall: .....
And I have list averages with one entry for each row (first one is Ashe's; second one; Azok's...)
averages = [12.4, 44.8880001, 32.4, 97.701]
I split the names with this code:
for line in inp:
line = line.split(": ")[0:1]
And when I tried to append each first elements of names and averages (second and second...):
for line in inp:
line = line.split(": ")[0:1]
#print(line)
for d in averages:
line.append(d)
print(line)
I'm having output like this:
['Ashe', 12.4, 44.8880001, 32.4, 97.701]
['Azok', 12.4, 44.8880001, 32.4, 97.701]
['Bumba', 12.4, 44.8880001, 32.4, 97.701]
['Thrall', 12.4, 44.8880001, 32.4, 97.701]
However, expected output is that:
['Ashe', 12.4]
['Azok', 44.8880001]
['Bumba', 32.4]
['Thrall', 97.701]
What changes does my code require? Thank you in advance.