If you want to know how many years it takes to double your money at a given interest rate, and you are willing to live with a good approximation, you can use the rule of 72, which gives the time, t, in terms of the interest rate, r:
t = 72.0 / r
The approximation provides an answer that is within 3.5 percent of the correct number of years for interest rates between 1 percent and 15 percent.
Later on, in the hardcopy version of this book, you see how to compute the doubling time exactly. For now, you are to learn how to define your own functions using the approximation formula.