CommencerCommencer gratuitement

Calculate your net worth

Now that you have forecasted your savings and salary over time while taking career progression and inflation into account, you have constructed a time-series which you can use to calculate your cash flows, just like in Chapter 1.

For this example, all you need to do is subtract your forecasted monthly expenses from your forecasted monthly salary. The remaining cash flow will go straight into your savings account for each month.

You want to project your cumulative savings over time to see how effective your budgeting process will be given your projections.

salary_forecast and expenses_forecast from the previous exercises are available.

Cet exercice fait partie du cours

Introduction to Financial Concepts in Python

Afficher le cours

Instructions

  • Forecast your monthly savings using projections for expenses and your monthly salary.
  • Calculate your cumulative savings over time.
  • Print the amount you have in your savings account after 15 years of diligent savings.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

import numpy as np

# Calculate your savings for each month
savings_forecast = ____

# Calculate your cumulative savings over time
cumulative_savings = ____

# Print the final cumulative savings after 15 years
final_net_worth = ____
print("Your final net worth: " + str(round(final_net_worth, 2)))

# Plot the forecasted savings
plt.plot(cumulative_savings, color='blue')
plt.show()
Modifier et exécuter le code