Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- invest_return = 1+(0.05/12)
- inflation = 1+(0.05/12)
- withdrawal_limit=3000
- base_cash = 200000
- base_income=100000
- base_expenditure=0
- minimum_payment = 0.1
- def next_month(net_inflation, debt,cash):
- cash = cash*invest_return
- income = base_income*net_inflation
- expenditure = base_expenditure*net_inflation
- cash += income - expenditure
- cash -= minimum_payment*debt
- debt -= minimum_payment*debt
- new_debt_ability = (inflation/minimum_payment)*(income-expenditure)-debt
- if new_debt_ability>=withdrawal_limit:
- cash += withdrawal_limit
- debt += withdrawal_limit
- elif new_debt_ability>0:
- cash += new_debt_ability
- debt += new_debt_ability
- return (net_inflation*inflation,debt,cash)
- def no_month(infl,cash):
- cash = cash*invest_return
- cash += (base_income-base_expenditure)*infl
- return(infl*inflation,cash)
- def simulate(months,cash):
- (i,d,c)=(1,0,cash)
- (a,b)=(1,cash)
- for n in range(0,months):
- (i,d,c)=next_month(i,d,c)
- (a,b)=no_month(a,b)
- return (i,d,c,b)
- a = simulate(24,base_income)
- print(f"Debt Strategy:\nCash: {a[2]}\nDebt: {a[1]}\nTotal: {a[2]-a[1]}\n")
- print(f"No Strategy:\nCash: {a[3]}\n")
- print(f"Profit: {a[2]-a[1]-a[3]}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement