Problem
We earn interest on money deposited in a bank. The interest we receive for the first year is added to the principal amount (which then is used for calculating the interest for the next year). This is called compound interest. Write a method, compound_interest
, to calculate how much money you'll receive back at the given rate after a certain number of years.
For example, with the following principal amount, interest rate, and the number of years, the compound interest is expected to be $2814749.77.
Get hands-on with 1400+ tech skills courses.