import os.path filename = input("Please enter filename: ") while not os.path.exists(filename): print("That file does not exist.") filename = input("Please enter filename: ") infile = open(filename, 'r') data = infile.readlines() infile.close() total = sum([float(v) for v in data]) avg = total / len(data) total = format(total, '2f') avg = format(avg, '2f') print('The total is: $', total, sep='') print('The average per day is: $', avg, sep='')