I apologize in advance - This is my third week using Python (3.4.1 on a Mac)
I need to read a text file, convert the values into numbers and calculate a total. The total I get doesn't match the values entered in the file. def main(): total = 0 infile = open('/Users/richarddillon/Desktop/numbers.txt', 'r') # read first record line = infile.readline() a = float(line) # read rest of records while line != '': total = total + a line = infile.readline() infile.close() print(total) main() _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor