You didn't mention how often the interest is compounded annually. Some common values to assume would be one (once a year) or four (quarterly).
Here is a function that returns the final amount, given the principal (initial investment), the annual rate, the number of years and the number of times the interest is compounded annually (a default parameter set to 1).
However, this is different from what the assignment is asking. You'll need a function that returns the number of years it takes for an investment to double. Given the previous function, we know the relationship of these variables and can rewrite the equation to yield our desired value, and build a function around that: