You will write three small functions that work out interest. The checker uses a savings account, a compound account and a target.
The idea. Simple interest is the same every year. Compound interest multiplies the money by each year. To find the time, keep adding years until the amount reaches the target.
Your tasks.
simple_interest(principal, rate, years). Return the interest only, not the total.compound_amount(principal, rate, years). Return the total amount after the years.years_to_reach(principal, rate, target). Return the smallest whole number of years after which the compound amount is at least target.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…