I'm a bit stuck on ps4.4, can you help? I'm calling both the functions with the following args: nestEggVariable(salary, save, preRetireGrowthRates) postRetirement(savings, postRetireGrowthRates, expenses) How do I pull the account balance out of the first function? I've tried return accountBalance (that's the name of my variable inside the function) but I'm at a loss as to what to do next. How do I create a list to run a binary search on?
what I did for this was pull the last value out of the list generated by nestEggVariable as that is the only one you care about for postRetirement. In order to do that you want to 'return' accountBalance[-1] That is assuming accountBalance is the list where your values are stored. The '[-1] will pull out only the last value in the list, which is the one you need...
Cool, that's a great start. So I've initialised them as global variables to pull out the last value in the list to use with postRetirement. I've got a value for savings of 5266.26, does that sound about right? Now its a matter of running a search for an expenses value that leaves the final balance of savings near zero?
Join our real-time social learning platform and learn together with your friends!