• API
• FAQ
• Tools
• Trends
• Archive
SHARE
TWEET

# Untitled

a guest Feb 23rd, 2013 30 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. print 'Given a starting balance and interest rate, this program will calculate your minimum monthly payment,'
2. print 'in increments of \$10, that will pay off your balance in 12 months or less.'
3.
4. balance = float(raw_input('Enter the outstanding balance on your credit card:'))
5. interestrate = float(raw_input('Enter the annual credit card interest rate as a decimal:'))
6.
7. payment = 0
8.
9. def twelvemonth ():
10.     global payment
11.     month = 0
12.
13.     while month <=11:
14.         month = month + 1
15.         if month==1:
16.             calcbalance = balance
17.             payment = payment + 10
18.         intowed = calcbalance*(interestrate/12)
19.         calcbalance = calcbalance + intowed - payment
20.         if calcbalance <= 0:
21.             print 'Monthly payment to pay off debt in 1 year:  \$' + str(round(payment, 2))
22.             print 'Number of months needed:  ' + str(month)
23.             print 'Balance:  \$' + str(round(calcbalance, 2))
24.             month = 12
25.
26.     if calcbalance > 0:
27.         twelvemonth ()
28.
29. twelvemonth ()
RAW Paste Data
Top