Created
September 16, 2020 23:48
-
-
Save joshparkerj/19be00b255587e9e75b79e6e1057de80 to your computer and use it in GitHub Desktop.
net worth over time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fire(age, expected_death, expected_retirement, savings, income, spending, rate): | |
import matplotlib.pyplot as plt | |
age *= 10 | |
expected_death *= 10 | |
expected_retirement *= 10 | |
remaining_tenths_of_a_year = int(expected_death-age) | |
ages = [] | |
savingses = [] | |
ages.append(age/10) | |
savingses.append(savings) | |
print('Age: ' + str(age/10) + ' Savings: ' + str(int(savings))) | |
for i in range(remaining_tenths_of_a_year): | |
savings *= (1 + rate / 100) ** (1/10) | |
if 1 + age + i == expected_retirement: | |
income = 0 | |
savings += (income - spending) / 10 | |
ages.append((age + i+1)/10) | |
savingses.append(savings) | |
print('Age: ' + str((age + i + 1)/10) + ' Savings: ' + str(int(savings))) | |
plt.subplots()[1].plot(ages,savingses) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment