Code:
def interest():
interest_rate = 0.06
investment = input(int('Investment: '))
yield = 0
year = 0
while (yield < investment):
year += 1
yield = investment * interest_rate
print (year)
NOTE: i wrote this code assuming that the investment for the next year is the same as the first year and so forth