Calculating compound interest
Compound interest is much more applicable in the real world and is an important feature in calculating the price of a bond, as you will see in the next chapter.
Now imagine the same savings account pays 3% per year as compound interest instead of simple interest. As before, you invest USD 10,000 for a period of ten years.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Bond Valuation and Analysis in Python
अभ्यास निर्देश
- Assign the present value, rate, and number of periods to
pv,r, andn, respectively. - Find how much money the savings account will have after ten years and print the result.
- Calculate and print the amount of interest earned over the ten years.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Assign present value, rate and number of periods
pv = ____
r = ____
n = ____
# Calculate the value of the savings account
fv = ____
print(fv)
# Calculate the total amount of compound interest earned
compound_interest = ____
print(compound_interest)