Laboratory Walkthrough 3

# Laboratory Walkthrough 3 - Submissiondeadline...

• CaptainStrawCrow5189
• 6

This preview shows page 1 - 3 out of 6 pages.

Intro2cs Ex3 – Retirement Submission deadline Thursday,07 Novembe r, 20:55 Objectives In this exercise you will practice the use of functions, loops and working with files. You will also become familiar with data structures such as lists and tuples. Ex4 Ex4 will be published during the next week, and its submission date is Nov 14th. Some of the issues in that exercise will be learned in the “tirgulim” of next week. Planning for the future One of the most debatable issues lately in Israel is the question of retirement accounts (Pension plans). As you embark on a career, retirement may seem very far away, but it is critical for each and every one of us. A big debate in the press is related to the question of how the retirement funds of our generation will look like. Assuming a larger life expectancy, our retirement money should provide for us for more years. We encourage you to read more and then compare information from different sources. Although retirement may seem a long way off for you, we are going to explore some simple ideas in pension plans. Along the way, we are going to explore the use of successive approximation methods, as well as the use of some simple data structures, such as lists. We will start with a simple model of saving for retirement. Let's assume that an employee earns a constant salary. Each year the employee saves some percentage of his salary into his retirement fund. Assume you are the worker and your starting yearly salary is represented by salary ; the percentage of your salary you put into a retirement fund is save ; and the annual growth percentage of the retirement fund is growth_rate. Then your retirement fund, represented by the list F, should increase as following: Retirement fund End of year 1 F[0] = salary * save*0.01 End of year 2 F[1] = F[0]*(1+growth_rate*0.01)+salary*save*0.01 End of year 3 F[2] = F[1]*(1+growth_rate*0.01)+salary*save*0.01

Subscribe to view the full document.

Assignment 1 Implement a function named constant_pension that receives four arguments: a salary, saving percentage (in percentage), an annual growth percentage for the investment account, and a number of work years. The function should return a list where each element in the list represents the value of the retirement fund in the end of a year, with the most recent year’s value at the end of the list. Complete the implementation of constant_pension(salary, save, growth_rate, years) Write the code in the appropriate place in ex3.py template (you can find the link below). Make sure you’ve implemented the function as demanded, testing for bad inputs. To test your function, compare it with the school solution.

{[ snackBarMessage ]}

###### "Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern