You are reading from your file twice at each iteration, but you are only storing half of the lines in data.
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
posted 4 years ago
I surmise that it is only printing the even numbered lines in your file. That is because your while statement is reading a line and then you read another line in the while loop. And you only print the line that was read in the loop. Try: