Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- balance=round(float(raw_input('Enter the outstanding balance on your credit card:')),2)
- annual=round(float(raw_input('Enter the annual credit card interest rate as a decimal:')),2)
- Mir=annual/12
- Ob=balance
- low = balance/12.0
- high = (balance*(1+Mir)**12.0)/12.0
- Mmp=(high+low)/2.0
- Ubem=balance*(1+Mir)-Mmp
- while Ubem > 0:
- Mmp=(high+low)/2.0
- print 'high:', high, '\tMmp:', Mmp, '\tlow:', low
- for i in range(1,13):
- if i == 1:
- balance=Ob
- Ubem=balance*(1+Mir)-Mmp
- balance=Ubem
- if Ubem < 0:
- break
- low = Mmp
- print 'RESULT'
- print 'Monthly payment to pay off debt in 1 year: ',Mmp
- print 'Number of months needed: ',i
- print 'Balance',round(balance,2)
Advertisement
Add Comment
Please, Sign In to add comment