import itertools

expenses = 0.05
earnings = 0.02
money = 1

for year in itertools.count():
    print("Year %s: %s%% left" % (year, money * 100))
    if money < 0:
        break

    # We'll be generous and assume that you get all of your yearly income
    # before paying for any expenses.
    money += money * earnings

    # Note that expenses are a fixed cost, not a percentage.
    money -= expenses