Advertisement
UME14

Problem1_PSet2

Jan 16th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Wed Jan 17 07:29:04 2018
  4.  
  5. @author: user
  6. """
  7.  
  8. #PSet2_Peoblem 2
  9.  
  10. balance = 42
  11. annualInterestRate = 0.2
  12. monthlyPaymentRate = 0.04
  13. #these 3 values above are to be defined by the grader
  14.  
  15. # resut to be KEPT and month to be DELETED when posting
  16. result = 0
  17. month = 0
  18.  
  19. for i in range(12):
  20.  
  21. monthlyInterestRate = (annualInterestRate)/12.0
  22. minimumMonthlyPayment = monthlyPaymentRate * balance
  23. monthlyUnpaidBalance = balance - minimumMonthlyPayment
  24. updatedBalance = monthlyUnpaidBalance + (monthlyInterestRate * monthlyUnpaidBalance)
  25.  
  26. result += minimumMonthlyPayment
  27. balance = updatedBalance
  28. month += 1
  29. print('Month' + str(month) + 'Remaining balance:' + str(round(result, 2)))
  30.  
  31. print('Remaining balance:' + str(round(result, 2)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement