how do I add this program to the body of a for loop so that it reoccur monthly for one year?
##OB = Outstanding Balance ##AIR = Annual Interest Rate ##MMPP = Minimum Monthly Payments Percentage ##MMP = Minimum Mnthly Payments ##IP = Interest Paid ##PP = Principal Paid ##RB = Remaining Balance OB=int(raw_input("Enter Outstanding Balance:")) AIR=float(raw_input("Enter Interest Rate(decimal):")) MMPP=float(raw_input("Enter Minimum Monthly Payment Percent(decimal):")) print "Month:", ##for each month of the year ##calculate minimum monthly payment ##??ad this amount to the total paid variable MMP = MMPP*OB ##print the min monthly payment print "Minimum Monthly Payment:",MMP ##calculate interest paid IP =(0.18/12.0)*OB ##Print Interest Paid print "Interest Paid:",IP ##Calculate Principal Paid, PP = Principal Paid PP = MMP-IP ##print Principal Paid print "Principal Paid:",PP ##Remaining Balanace RB = OB-PP ##print Remaining Balance print "Remaining Balance:",RB ##print total paid
use either a while loop, or for loop: ``` month = 1 while month <= 12: ## do stuff print month month += 1 ``` or ``` for month in range (1,13): ## do stuff print month ``` notice that on each iteration, the variable month is updated, so printing out that variable will give the correct number for the month you are on
thanks so much looks like that should be it!
Join our real-time social learning platform and learn together with your friends!