Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

14/05/2017 Untitled

M.Sugandi
1407123427
TeknikkimiaS1(B)

personinvestsUSD1000inasavingaccountyielding5percentinterest.Assumingthatallinterestislefton
depositintheaccount.Calculateandprinttheamountofmoneyintheaccountattheendofeachyearfor10
years.Usethefollowingformulafordeterminingtheamounts:

a = p(1 + r)n
where

*pistheoriginalamountinvested(i.e.,theprincipal);
*ristheannualinterestrate;
*nisthenumberofyearsand;
*aistheamountondepositattheendofthenthyear;

In[8]:

definterest(principal,rate,times_per_year,years):
body=(1+rate)
exponent=years
returnprincipal*pow(body,exponent)

#Compute0.5%annualyinterestfor10years.
result=interest(1000,0.05,1,10)
#Result.
print(result)
print()

1628.89462678
()

http://localhost:8888/notebooks/Untitled.ipynb?kernel_name=python2 1/1

You might also like