Professional Documents
Culture Documents
# Compute 0.5% Annualy Interest For 10 Years. # Result
# Compute 0.5% Annualy Interest For 10 Years. # Result
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