## Python

Moderators: None (Apply to moderate this forum)
Number of posts: 1166

This Forum Only

Help with problem Posted by illectronic on 10 Oct 2012 at 8:09 AM
I need to write a program to calculate the minimum payment per month for an initial balance. The balance accrues interest each month at a set rate. The first month should not have any interest. The minimum payment needs to be in increments of 10. I got this so far, but the answer is coming up over by 10. I got 370 and it should be 360. Any help will be appreciated.

```month = 1
balance = 3926
annualInterestRate = 0.2
payment = 0

while balance >= 0:
remainingBalance = balance - payment
while month < 12:
monthlyInterest = (annualInterestRate) / 12
remainingBalance = (remainingBalance - payment) * (1 + monthlyInterest)
month +=1
if month == 12:
payment += 10
if remainingBalance <= 0:
break
month = 1

print "Lowest Payment: " + str(payment)```

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic