Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

def College fund (name): print(\'Please enter the following\') p-float(input (\'

ID: 3710576 • Letter: D

Question

def College fund (name): print('Please enter the following') p-float(input ('Principle: ')) IR-float (input( 'Interest rate:)) print( 'Hi, ' , name) print('---' file-open (OptD.txt', 'r') for line in file: 3st ] line-line.strip() lst.append(float (line)) total-O year-total- for i in range(len (1st)): if (i+1)%12!-0: total-total+lst[i] elise pend (total) year total.ap total-0 k-k+12 year_total.append (sum(1st[k:])) print( 'Yearly savings') for val in year total: print (val)

Explanation / Answer

Make sure your file has 1 number on each line That's the reason why you are getting this error use this to read data from file, it will skip empty strings for line in file: line = line.strip() if len(line) > 0: lst.append(float(line)) Make sure your file has 1 number on each line That's the reason why you are getting this error use this to read data from file, it will skip empty strings for line in file: line = line.strip() if len(line) > 0: lst.append(float(line))