Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. invest_return = 1+(0.05/12)
  2. inflation = 1+(0.05/12)
  3. withdrawal_limit=3000
  4. base_cash = 200000
  5. base_income=100000
  6. base_expenditure=0
  7. minimum_payment = 0.1
  8.  
  9. def next_month(net_inflation, debt,cash):
  10. cash = cash*invest_return
  11. income = base_income*net_inflation
  12. expenditure = base_expenditure*net_inflation
  13.  
  14. cash += income - expenditure
  15. cash -= minimum_payment*debt
  16. debt -= minimum_payment*debt
  17.  
  18. new_debt_ability = (inflation/minimum_payment)*(income-expenditure)-debt
  19. if new_debt_ability>=withdrawal_limit:
  20. cash += withdrawal_limit
  21. debt += withdrawal_limit
  22. elif new_debt_ability>0:
  23. cash += new_debt_ability
  24. debt += new_debt_ability
  25.  
  26. return (net_inflation*inflation,debt,cash)
  27.  
  28. def no_month(infl,cash):
  29. cash = cash*invest_return
  30. cash += (base_income-base_expenditure)*infl
  31. return(infl*inflation,cash)
  32.  
  33. def simulate(months,cash):
  34. (i,d,c)=(1,0,cash)
  35. (a,b)=(1,cash)
  36. for n in range(0,months):
  37. (i,d,c)=next_month(i,d,c)
  38. (a,b)=no_month(a,b)
  39. return (i,d,c,b)
  40.  
  41. a = simulate(24,base_income)
  42. print(f"Debt Strategy:\nCash: {a[2]}\nDebt: {a[1]}\nTotal: {a[2]-a[1]}\n")
  43. print(f"No Strategy:\nCash: {a[3]}\n")
  44. print(f"Profit: {a[2]-a[1]-a[3]}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement