Help with problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help with problem

illectronicillectronic Posts: 2Member
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:
month = 1

print "Lowest Payment: " + str(payment)[/code]
Sign In or Register to comment.