Advertisement
Transfusion

eugene_loop.py

Mar 29th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.67 KB | None | 0 0
  1. import math
  2. balance = 3926
  3. annualInterestRate = 0.2
  4. monthlyPayment = 0
  5.  
  6. initial_balance = balance
  7. while balance > 0 and not math.isinf(balance):
  8.     monthlyPayment += 10
  9.     balance = initial_balance
  10.     for i in range(1,13):
  11.         if i < 13:
  12.             balance -= monthlyPayment
  13.             balance += annualInterestRate / 12 * balance
  14.  
  15.     print balance
  16. print monthlyPayment
  17.  
  18. # print ("Lowest Payment:", monthlyPayment)
  19.  
  20. # initBalance = balance
  21. # monthlyInterestRate = annualInterestRate / 12.0
  22. # month = 0
  23. # minPay = 10
  24. # def calculate(month, balance, minPay, monthlyInterestRate):
  25. #     while month <12:
  26. #         unpaidBalance = balance - minPay
  27. #         balance = unpaidBalance + (monthlyInterestRate * unpaidBalance)
  28. #         month += 1
  29. #     return balance
  30. # while calculate(month, balance, minPay, monthlyInterestRate) > 0:
  31. #     balance = initBalance
  32. #     minPay +=10
  33. #     month = 0
  34. #     calculate(month, balance, minPay, monthlyInterestRate)
  35. # print('Lowest Payment: ' + str(minPay))
  36.  
  37.  
  38. # initBalance = balance
  39. # monthlyInterestRate = annualInterestRate / 12.0
  40. # month = 0
  41. # minPay = 10
  42. # def calculate(month, balance, minPay, monthlyInterestRate):
  43. #     while month <12:
  44. #         unpaidBalance = balance - minPay
  45. #         balance = unpaidBalance + (monthlyInterestRate * unpaidBalance)
  46. #         month += 1
  47. #     return balance
  48. # while calculate(month, balance, minPay, monthlyInterestRate) > 0:
  49. #     balance = initBalance
  50. #     minPay +=10
  51. #     month = 0
  52. #     calculate(month, balance, minPay, monthlyInterestRate)
  53. # print('Lowest Payment: ' + str(minPay))
  54.  
  55. # monthlyInterestRate = annualInterestRate / 12.0
  56. # upr = balance *
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement