I'm working on an assignment that reads data from a file. I'm trying to sum up all the even numbers in the file but I can't get it to read more than the first line. Here is the code I have so far:
infile = open('data.txt', 'r')
even_sum = 0
line = infile.readline()
while int(line) % 2 == 0:
...