Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #retirieve input
- balance = float(raw_input('Type balance:'))
- interestRate = float(raw_input('Type interest rate:'))
- #initialize state variables
- monthlyRate = interestRate/12.0
- minPayment = 0
- postBalance = balance
- while balance > 0:
- minPayment += 10
- postBalance = balance
- numMonths = 0
- while numMonths < 12 and postBalance > 0:
- numMonths += 1
- interest = monthlyRate * postBalance
- postBalance -= minPayment
- postBalance += interest
- postBalance = round(postBalance,2)
- print 'result'
- print 'Monthly payment to pay off debt in one year:', minPayment
- print 'Number of monthly payments:', numMonths
- print 'Balance:',postBalance
Advertisement
Add Comment
Please, Sign In to add comment