#### Credit card balance exercise in Python

1. 信用卡上的未结余额
2. 年利率为小数

``````>>>
Enter the outstanding balance: 1200
Enter annual interest rate: 0.18
RESULT
Monthly payment to pay off debt in 1 year: 120
Number of months needed: 11
Balance: -10.05
>>>
``````

``````## ob = float (raw_input ("Enter the outstanding balance:"))
##accir = float(raw_input("Enter annual interest rate:"))

ob = float (1200)
mp = float (0)
n = float (0)

while rb >= 0:
rb = ob
mp += 10
n += 1
rb = ( rb*(1 + (accir/12.0)**n) -         n*mp)

print "Result:"
print "Monthly payment to pay off debt in one year:" , mp
print "Number of months needed:" , n
print "Balance:" , rb
``````

``````>>>
Result:
Monthly payment to pay off debt in one year: 110.0
Number of months needed: 11.0
Balance: - 10.0
>>>
``````

1 个回复

``````At = A0(1 + r)^t
``````

``````r = (At/A0)^1/t - 1
``````

``````def main(rb):
count = 0
while rb > 0:
rb = round(rb*(0.18/12 + 1) - 120, 2)
count += 1
#print(count, rb)
return count, rb

print(main(input('Balance: ')))   #Balance: 1200
``````

1 如何获得信用卡余额？

2 信用卡api /抓取以获得余额

3 SQL Server触发器检查信用卡余额

4 试图找到十的最低倍数以使用python还清信用卡余额

5 Python信用卡验证

2016-11-19 01:06:28 7 22780   luhn
7 在python中验证信用卡号

2015-10-23 06:39:46 1 2310   list/ luhn
8 Python：验证信用卡数字

9 Python中的信用卡交易分类

10 信用卡欺诈的 Python 算法