let's say i have a file with data like that:
Bicycle,204,28,271,193
Bicycle,136,190,79,109
I want to add the numbers with each other so that the new lines will be like that
Bicycle,204,28,475,221 #as 271+204=475 and 28+193=221
Bicycle,136,190,215,229 #as 136+79=215 and 190+190=229
and so on so how can i do that note I tried to split the numbers like that:
with open(filepath) as f:
matrix=[line.split(',') for line in f]
f.close()
print(matrix[0])
so when I print matrix it gives me this output
['Bicycle', '204', '28', '271', '193\n']
so how can I sum the numbers and modify my file to have the new numbers?