<blockquote>
<p>Now write a program that calculates the minimum fixed monthly payment needed in order pay off a credit card balance within 12 months. By a fixed monthly payment, we mean a single number which does not change each month, but instead is a constant amount that will be paid each month.</p>
<p>In this problem, we will not be dealing with a minimum monthly payment rate.</p>
<p>The following variables contain values as described below:</p>
<ul>
<li><code>balance</code> - the outstanding balance on the credit card</li>
<li><code>annualInterestRate</code> - annual interest rate as a decimal</li>
</ul>
<p>The program should print out one line: the lowest monthly payment that will pay off all debt in under 1 year, for example:</p>
<pre><code>Lowest Payment: 180
</code></pre>
<p>Assume that the interest is compounded monthly according to the balance at the end of the month (after the payment for that month is made). The monthly payment must be a multiple of $10 and is the same for all months. Notice that it is possible for the balance to become negative using this payment scheme, which is okay. A summary of the required math is found below:</p>
<ul>
<li>Monthly interest rate = (Annual interest rate) / 12.0</li>
<li>Monthly unpaid balance = (Previous balance) - (Minimum fixed monthly payment)</li>
<li>Updated balance each month = (Monthly unpaid balance) + (Monthly interest rate x Monthly unpaid balance)</li>
</ul>
</blockquote>
<p>这是我的密码。我不知道我错在哪里:</p>
<pre><code>balance = float(raw_input('enter the outsanding balance on your card'))
annualInterestRate = float(raw_input('enter the anual interest rate as a decimal'))
month = 0
checkBalance = balance
monthlyFixedPayment = 0
while checkBalance <= 0:
checkBalance = balance
monthlyFixedPayment += 10
while month <= 11:
monthlyInterestRate = annualInterestRate/12.0
monthlyUnpaidBalance = checkBalance - monthlyFixedPayment
checkBalance = monthlyUnpaidBalance + (monthlyInterestRate * monthlyUnpaidBalance)
print('lowest payment:' + str(monthlyFixedPayment))
</code></pre>