Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

| Download
Views: 23
Image: ubuntu2004
Kernel: Python 3 (system-wide)

Make a 1-time deposit of $1,000 into a savings account that earns a 4.4% annual interest (compounded monthly) for 30 years.

For this taks we will need to find a value of an account after a fixed amount of time P - Principal (1000) r - Annual interest rate (0.044) n - Number of compoundings per year (12) c - Contribution to principal per compounding period (none) y - Years (30)

def com_int(p,r,n,c,y): for i in range (n*y): #we use loop to find principal after 30 years(360 months) p = p*(1+r/n)+c return p
com_int(1000,0.044,12,0,30) #input our values from first plan here
3734.3952805626127

Make monthly deposits of $5 into a savings account that earns a 4.4% annual interest (compounded monthly) for 30 years.

For this task we will need to find a value of an account after a fixed amount of time with monthly contributions.

com_int(5,0.044,12,5,30) #This time we input 5 for c since we contribute $5 each month
3747.392813533614

Thus, we see that the second plan is slightly better, which allows us to conclude that both plans are almost the same after 30 years.