def how_long_to_double(given_amount, rate):
'''
Returns the number of years it will take for the
given amount to double, if interest is added at
the given rate per year
'''
years = 0
balance = given_amount
while balance < 2 * given_amount:
balance = balance + balance * rate
years += 1
return years