Question: I need help in constructing a accumulator 'for loop' that calculates salary at each age. Here is an example of what I am trying to
I need help in constructing a accumulator 'for loop' that calculates salary at each age.
Here is an example of what I am trying to output ( I will format to output to text file) and here is my code so far.


Age Salary Total 26, 21000. 00, 41000.00 27, 22050. 00, 63050.00 28, 23152. 50, 86202.50 29, 24310. 12, 110512. 62 30, 25525. 63, 136038.26 31, 26801. 91, 162840.17 32 , 28142. 01, 190982. 18 33, 29549. 11, 220531. 29 34, 31026. 56, 251557.85 35, 32577. 89, 284135.74def earnings (name, age, salary) : b = (age) = (salary) 1 = list (range (age, 65) ) rate = .05 left = 65 - b total = current = salary for x in range (age, 65) : x += 1 print (x) for i in range (0, left-1) : current = current + current*0. 05 total += current r = round (total, 2) print (r)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
