我在while循环中尝试做的是用整数10迭代付款,这样如果整数(g)CBalance <= 0
在12个月内未能获得,那么所有变量都会重置,除了g,它会上升由 1。
Balance = float(raw_input('Enter Balance '))
Rate = float(raw_input('Enter interest rate '))
monthlyI = Rate/12
month = 0
g = 1
Payment = 10
CBalance = Balance
while CBalance > 0:
Payment = Payment*g
month += 1
CBalance = CBalance *(1+ monthlyI)- Payment
if month > 12:
month = 0
g += 1
Cbalance = Balance