mercredi 6 juillet 2016

MITx: 6.00.1x Introduction to Computer Science and Programming Using Python


So I'm very new to Python... The problem is as follows:

Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month.

My current code is as follows:

My Code

Here's the correct output:

Correct Output

So all the numbers are identical in both outputs but my Total Paid ends up being 1732.94 instead of the correct amount which is 1775.55. I added the numbers from my output up on a side calculator and it came out to 1775.55 as well. Is there something in my code that's borking this?

Here are the values for the variables that the test code uses: balance = 4213; annualInterestRate = 0.2; monthlyPaymentRate = 0.04


Aucun commentaire:

Enregistrer un commentaire