Exercise 3: When Will the Savings Reach the Goal? — Possible Solution ==================================================================== goal = 5000.0 deposit = 200.0 monthly_rate = 0.005 balance = 0.0 months = 0 while balance < goal: balance = balance * (1 + monthly_rate) + deposit months += 1 years = months // 12 extra_months = months % 12 print(f"Goal reached after {months} months ({years} years {extra_months} months)") print(f"Balance: {balance:.2f}") Example run: Goal reached after 24 months (2 years 0 months) Balance: 5086.39 WHY THIS WORKS AS AN ANSWER ------------------------------ The condition balance < goal is the whole stopping rule: as soon as a pass lifts the balance to the goal or beyond, the loop ends. balance * (1 + monthly_rate) adds a month of interest, then the deposit is added. The loop stops once balance >= goal, so the final balance is slightly above 5000 and not exactly 5000; an exact match is unlikely, and the program must never wait for one. months // 12 and months % 12 split the total into whole years and the remainder.