id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david.white@denison.edu cs111fall2019 > compoundInterestAmount
prev  |  next  |  chance

You have a bank account which begins with P dollars (P>0) and has a nominal yearly interest rate (aka APR) of r. Notice that we didn't say "r percent" here so you should assume 0<r<1. Suppose your money is compounded several times per year, so that in reality you'll have more than P*(1+r) at the end of a year (the true rate of interest you're being paid is the APY). Write a function compoundInterestAmount(P,r,y,dt) which computes the amount of money you'll have after y years, where compounding happens once in each interval of length dt. Your function should return the integer part of the number it computes.


compoundInterestAmount(100, 0.05, 1, 0.1) → 105
compoundInterestAmount(1000, 0.05, 1, 0.1) → 1051
compoundInterestAmount(1000, 0.03, 7, 1) → 1229

...Save, Compile, Run (ctrl-enter)

def compoundInterestAmount(P,r,y,dt):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy