nicokruk

MIT 6.00SC - Problem Set 1 - Problem 1

Jun 10th, 2012
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. balance = float(raw_input('Enter the outstanding balance on your credit card: '))
  2. annual_interest = float(raw_input('Enter the annual credit card interest rate as a decimal: '))
  3. minimum_payment_rate = float(raw_input('Enter the minimum monthly payment rate as a decimal: '))
  4. total_paid = 0
  5. for month in range(1,13):
  6.     minimum_monthly_payment = round(balance * minimum_payment_rate,2)
  7.     interest_paid = round(annual_interest / 12 * balance,2)
  8.     principle_paid = round(minimum_monthly_payment - interest_paid,2)
  9.     total_paid += minimum_monthly_payment
  10.     print 'Month:', month
  11.     print 'Minimum monthly payment: $', minimum_monthly_payment
  12.     print 'Principle paid: $', principle_paid
  13.     print 'Remaining balance: $', balance - principle_paid
  14.     balance = balance - principle_paid
  15. print 'RESULT'
  16. print 'Total amount paid: $', total_paid
  17. print 'Remaining balance: $', balance
Advertisement
Add Comment
Please, Sign In to add comment