Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print 'Given a starting balance and interest rate, this program will calculate your minimum monthly payment,'
- print 'in increments of $10, that will pay off your balance in 12 months or less.'
- balance = float(raw_input('Enter the outstanding balance on your credit card:'))
- interestrate = float(raw_input('Enter the annual credit card interest rate as a decimal:'))
- payment = 0
- def twelvemonth ():
- global payment
- month = 0
- while month <=11:
- month = month + 1
- if month==1:
- calcbalance = balance
- payment = payment + 10
- intowed = calcbalance*(interestrate/12)
- calcbalance = calcbalance + intowed - payment
- if calcbalance <= 0:
- print 'Monthly payment to pay off debt in 1 year: $' + str(round(payment, 2))
- print 'Number of months needed: ' + str(month)
- print 'Balance: $' + str(round(calcbalance, 2))
- month = 12
- if calcbalance > 0:
- twelvemonth ()
- twelvemonth ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement