Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- initial_balance = float(raw_input('Enter the outstanding balance on your credit card: '))
- annual_interest = float(raw_input('Enter the annual credit card interest rate as a decimal: '))
- monthly_interest = annual_interest/12.0
- multiples_of_ten = 1
- monthly_payment = 10
- termination_checker = 0
- for multiples_of_ten in range (1, (int(initial_balance/10)+1)):
- balance = initial_balance
- total_paid = 0
- months = 1
- while termination_checker == 0 and months <=12:
- ## print 'Month:', months
- total_paid += monthly_payment * multiples_of_ten
- ## print 'Monthly payment was: $',monthly_payment * multiples_of_ten
- ## print 'Total paid so far on month #',months,'is $',total_paid
- balance = balance * (1 + monthly_interest) - (monthly_payment * multiples_of_ten)
- ## print 'Balance after month #',months,'is $',balance
- ## print 'Current monthly payment multiplier is 10 *',multiples_of_ten
- ## print '--------------------------------------------'
- if balance <= 0:
- print '**************************************'
- print 'RESULT'
- print 'Monthly payment to pay off debt in 1 year: $', monthly_payment * multiples_of_ten
- print 'Number of months needed:', months
- print 'Balance: $',round(balance,2)
- print '***************************************'
- termination_checker = 1
- else:
- months += 1
Advertisement
Add Comment
Please, Sign In to add comment