This preview shows page 1. Sign up to view the full content.
Unformatted text preview: our expenses without
entering into debts. We will assume constant expenses on each year. How may we calculate it? One
option would be to try feeding different values of expenses to post_retirement() – and find the best value
(i.e. maximum expenses such that the last value in the returned list will still be a positive)
Remember that in class we saw the idea of binary search. We can use this idea also here to find the
correct value. In this assignment you may choose to use also pure arithmetics for this calculation.
Implement l v _ i e a k n , which takes five arguments: a s l r , a percentage of your
salary to save (s v ), a list of annual growth rate before retirement
(p e r t r _ r w h r t s, a list for after the retirement
(p s _ e i e g o t _ a e ), and a value for stop searching (e s l n. As before the
length of the p e r t r _ r w h r t s will be the amount of working years and
r_eiegot_ae p s _ e i e g o t _ a e ill account for the num...
View Full Document
This document was uploaded on 03/20/2014 for the course CMSC 67101 at Hebrew University of Jerusalem.
- Spring '14