Skip to content

Instantly share code, notes, and snippets.

@e3ntity
Created September 2, 2019 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e3ntity/fd5ee65294c336f7ffacff1697124bd6 to your computer and use it in GitHub Desktop.
Save e3ntity/fd5ee65294c336f7ffacff1697124bd6 to your computer and use it in GitHub Desktop.
money = 200 # Starting money
money_invested = 1.0 # Percentage of money invested (1.0) for everything
yearly_income = 1000 # Yearly income
taxfree_income = 500
yearly_spending = 1000 # Amount spent yearly
annual_return = 0.03 # Annual return for invested money (0.05) for 5%
period = 4 # Time period to calculate for
ic = 0 # income class, dont change!
def tax(income):
global ic
if income < 8130:
ic = 1
return 0
elif income < 13470:
ic = 2
y = (income - 8130) / 10000
return (933.7 * y + 1400) * y
elif income < 52882:
ic = 3
z = (income - 13469) / 10000
return (228.74 * z + 2397) * z + 1014
elif income < 250731:
ic = 4
x = income
return 0.42 * x - 8196
ic = 5
return 0.45 * x - 15718
for i in range(0, period):
print("After {} years: {}".format(i, money))
brutto_income = money * money_invested * annual_return + yearly_income - yearly_spending
oic = ic
netto_income = brutto_income - tax(brutto_income)
if ic > oic:
print("Upgrade to income class {}".format(ic))
money = money + netto_income + taxfree_income
print("Final amount: {}".format(money))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment