Guest User

Untitled

a guest
Jun 21st, 2012
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. balance=round(float(raw_input('Enter the outstanding balance on your credit card:')),2)
  2. annual=round(float(raw_input('Enter the annual credit card interest rate as a decimal:')),2)
  3. Mir=annual/12
  4. Ob=balance
  5. low = balance/12.0
  6. high = (balance*(1+Mir)**12.0)/12.0
  7. Mmp=(high+low)/2.0
  8. Ubem=balance*(1+Mir)-Mmp
  9. while Ubem > 0:
  10.     Mmp=(high+low)/2.0
  11.     print 'high:', high, '\tMmp:', Mmp, '\tlow:', low
  12.     for i in range(1,13):
  13.         if i == 1:
  14.             balance=Ob
  15.         Ubem=balance*(1+Mir)-Mmp
  16.         balance=Ubem
  17.         if Ubem < 0:
  18.             break
  19.     low = Mmp
  20. print 'RESULT'
  21. print 'Monthly payment to pay off debt in 1 year: ',Mmp
  22. print 'Number of months needed: ',i
  23. print 'Balance',round(balance,2)
Advertisement
Add Comment
Please, Sign In to add comment