Hi, i am having trouble with the While Loop for my homework, I am suppose to write a program that says you owe someone money and then with the beginning balance, interest rate and monthly payment entered, I am suppose to use the While Loop to make sure that the amount paid will be subtracted from the total amount owe each month but with the program I wrote, the amount never subtracts, the same amount just keeps on appearing until I use the CTRL+C, and here is the program that I have written:

BegBal = raw_input ("Enter your beginning balance:")
BegBal = float(BegBal)

Interest = raw_input ("Enter the interest rate:")
Interest = float(Interest)

MonPayment = raw_input ("Enter your monthly payment:")
MonPayment = float(MonPayment)


Payment = BegBal*((Interest/100)/12)

if (MonPayment <= Payment):
print "Your monthly payment is not enough to pay off your debt, please make a bigger payment."
raw_input ("Press Enter to exit")


else:
while Balance !=0:
MonthlyBalance = MonPayment+Payment
Balance = BegBal-MonthlyBalance
print "Monthly Balance:", MonthlyBalance
print "Balance:", Balance

Can someone please give me some advice on how to fix it.

I think this:
Balance = BegBal - MonthlyBalance
should be this:
Balance = Balance - MonthlyBalance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.