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

 

ferrer@hendrix.edu > compound_savings
prev  |  next  |  chance

Write a function to count the number of years necessary to reach a savings goal, given initial principal and an interest rate. For example, with $100 of initial principal and a 10% annual interest rate, it would take eight years to reach $200. (After 1 year, we have $110; after two years, $110 + $11 = $121; after three years, $121 + $12.10 = $132.10; and so forth).


compound_savings(100, 0.1, 200) → 8
compound_savings(100, 0.05, 200) → 15
compound_savings(100, 0.02, 200) → 36

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

def compound_savings(principal, annual_rate, goal):

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

Post-solution available

Copyright Nick Parlante 2017 - privacy