How do I get my code to print out one number for how many times my while loop ran?
I'm writing a code to determine how many months it would take for me to pay for a house. I'm trying to get the last section of code to give me a single number for how many times my loop ran, instead of printing every single iteration(which inevitably always ends with a time out error). total_cost=float(input("Enter the cost of your dream home: ")) print(total_cost) annual_salary=float(input("Enter your annual salary: ")) print(annual_salary) monthly_salary=annual_salary/12 portion_saved=float(input("Enter the percentage of your salary to save, as a decimal: ")) print(portion_saved) portion_down_payment=0.25*total_cost r=0.04 current_savings=portion_saved*r/12 mortgage=total_cost-portion_down_payment total_cost=mortgage while total_cost>current_savings: print("Number of months: ", current_savings) current_savings+=1