I am supposed to work out the periodic investment amount given the target wealth.
This is my user defined code:
def contribution_calculator(target_wealth, rate, duration, periodicity):
inv_amt = -npf.pmt(rate/100/periodicity, duration*periodicity, 0, target_wealth)
return inv_amt
These are my 5 test cases which I have put them into their respective list.
target_wealth = [1000000, 1000000, 3000000, 3000000, 2000000]
rate = [2.5, 2.5, 0.5, 4.0, 3.0]
duration = [25, 12, 25, 25, 10]
periodicity = [12, 1, 12, 12, 2]
For example, the values for test case 1 are 1000000, 2.5, 25, 12.
How can I write a for loop such that it will test all the 5 given test cases?