0
如何繼續下面的循環,直到找到mmp = 310
?到目前爲止,我的代碼最遠的地方是mmp = 240
。你認爲我應該多一個if
聲明?如何計算信用卡的固定月付款
balance = 4213
annualInterestRate = 0.2
mir = annualInterestRate/12
monthlyPaymentRate = 0.04
rb = balance
mmp = 0
Month = 1
while Month <= 12:
print('Month:' + str(Month))
mmp = mmp + 10
print('Minimum monthly payment:' + str(mmp))
ub = rb - mmp
rb = round(ub + (annualInterestRate/12 * ub), 2)
Month = Month + 1
print('Remaining balance:' + str(rb))
if rb > 0:
rb = balance
Month = 1
while Month <= 12:
print('Month:' + str(Month))
mmp = mmp + 10
print('Minimum monthly payment:' + str(mmp))
ub = rb - mmp
rb = round(ub + (annualInterestRate/12 * ub), 2)
Month = Month + 1
print('Remaining balance:' + str(rb))
else:
print('Lowest Payment:' + str(mmp)
我必須有'一個月<= 12'在我的代碼。 – upendra 2013-02-22 15:39:42
@ user1755155:查看更新 – Junuxx 2013-02-22 15:44:47
是的,這是作業問題,我得到了非常嚴重的困難。還有一件事是它只能是'1年',所以基本上我必須計算在'12個月'rb <0'時mmp是多少。 – upendra 2013-02-22 15:53:14