-
Notifications
You must be signed in to change notification settings - Fork 0
/
PS1-P2
30 lines (23 loc) · 832 Bytes
/
PS1-P2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
##How to pay off your credit card
balance = float(raw_input('Enter the outstanding balance: '))
annualInterest = float(raw_input('Enter the annual interest rate as a decimal: '))
payment = int(10)
thisBalance = balance
monthlyInterest = float(0.0)
month = 0
while thisBalance >= 0:
while month < 12:
if thisBalance < 0:
break
monthlyInterest = ((annualInterest/12)*thisBalance)
thisBalance += monthlyInterest
thisBalance = thisBalance - payment
month += 1
##print "interest ", monthlyInterest, "balance ", thisBalance, "month ", month
if thisBalance > 0:
thisBalance = balance
month = 0
payment +=10
else:
break
print "Minimum payment is ", payment, "final balance is ", thisBalance, "it took ", month, "months."