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")

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.

10 Years
Discussion Span
Last Post by Ene Uran
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.