Can you please give us examples of numbers which stuff up the program and the FULL error statement because that will help even more. Also tell us wether you are doing a withdrawal, deposit or something else at that time.
Oh and please wrap your code in code tags. I will do it for you this time
def process(balance):
trans_type= raw_input("Enter Deposit(d), withdrawal(w), print(p), or quit(q):")
amount=input("Enter the amount:")
if amount<0:
print"You've entered an invalid number."
if trans_type=="d":
balance=int(balance)+int(amount)
print"Your current balance is", balance
elif trans_type=="w":
balance=int(balance)-int(amount)
print"Your current balance is", balance
return balance
def main():
balance=5000
restart=raw_input("Would you like to complete a transaction? (y/n):")
while "y"==restart:
balance = process(balance)
main() Also notice at the while "y" == restart bit? That will never stop executing. Replace all of main with another main method like this:
def main()
restart = raw_input("Would you like to complete a transaction? (y/n):")
balance = 5000
while restart == "y":
balance = process(balance)
restart = raw_input("Would you like to complete another transaction? (y/n):")