Sorry for all the questions! In the first problem, "Credit Card Debt," how would one find the total principle paid? I know that in the program below, it is all the values of r added up, but I can't figure out how to deal with it in each separate time it loops.
## Calculate balance for compound interest. x = float(raw_input('Enter current balance ')) y = float(raw_input('Enter annual interest rate ')) z = float(raw_input('Enter minimum monthly payment rate ')) for ans in range(1,13): t = x * z p = (y/12.0) * x r = t - p x = x - r print 'Minumun monthly payment ', t print 'principle paid ', r print 'remaining balance ', x print 'Total principle paid ', ~blank spot...~ print 'Balance ', x
Total principle paid, start with a var outside your loop. So after you ask the user to input their x, y and z, name a new var and make it equal to 0. a = 0 in the loop, you do something like a = a + r and then at the end when you are printing your results, you just print var a. I think this should get you your total principle paid over 12 months
Join our real-time social learning platform and learn together with your friends!