Suppose you currently have $50,000 deposited into a bank account and the account pays you a constant interest rate of 3.5% per year on your deposit. You are planning to buy a house with the current price of $300,000. The price will increase by 1.5% per year. It still requires a minimum down payment of 20% of the house price. Write a while loop to calculate how many (integer) years you need to wait until you can afford the down payment to buy the house. m = 50000 #money you have i = 0.035 #interest rate h = 300000 #house price f = 0.015 #amount house will increase by per year d= 0.2 #percent of down payment on house y = 0 #number of years x = 0 #money for the down payment mn = h*d #amount of down payment while m <= mn: m = (m+(m*i)) #money you have plus money you have times interest y = y + 1 #year plus one mn = mn +(h*f*y) print(int(y)) The answer you should get is 10. I keep getting the wrong answer, but I am not sure what is incorrect. Continue reading...