hi i have a big file filed with number. About 15 line of several number. Im trying to read it in roups of 4 lines and printing the result for every 4 lines. I have this code for now wich prints too many results id only want the final ones. But it also stops at the first four lines. is there a way to make it continue until the end? looking for this type of output:
Lignes 1-4 => 125
Lignes 5-8 => 2073
Lignes 9-12 => 559
Lignes 13-16 => 471
thank you in advance for any help.
for i in range(4):
line = ""
somme2 = 0
for i in range(4):
line = fichNbr.readline().split()
for n in line:
somme2 += int(n)
print(somme2)