#1234 is the pin number, if you type any other number it will return you to beginning BALANCE =0 def get_balance(): see = raw_input("Enter 'y' for yes or 'n' for no: ") if (see == "Y") or (see == "y"): print ("Current balance: " + str(BALANCE)) else: return def deposit(): global BALANCE Amount = input("Enter amount to deposit: ") print ("Amount to be deposited:" , Amount) print ("Before balance :", BALANCE) BALANCE = Amount + BALANCE print ("After balance :", BALANCE) def withdraw(): global BALANCE Amount = input("Enter amount to withdraw: ") print ("Amount to be withdraw:" , Amount) print ("Before balance :", BALANCE) if(Amount>BALANCE): BALANCE =BALANCE - Amount else: BALANCE =Amount-BALANCE print ("After balance :", BALANCE) def verify_pin(pin): if pin == 1234: print("Log in Successful") return True else: while(pin != 1234): print "It's not confirmed, please try again." pin = int(raw_input("Please enter your account pin number: ")) if (pin ==1234): print("Log in Successful") return True def show_instructions(): """ This function shows the instruction to the user how to operate the program. [PURPOSE] """ print"Type any of the following alphabet now for the following operation." print"'b' for Balance" print"'d' for Deposit" print"'w' for Withdraw" print"'q' for Quit" def end(): print("Thank you for Banking with Bank of Temple, goodbye!") exit() def main(): pinCheck = False print ("Hello, welcome to Bank of Temple!") pin = int(raw_input("Please enter your account pin number: ")) pinCheck = verify_pin(pin) show_instructions() choice=raw_input("Enter your choice :") while(pinCheck): while (choice=='b' or choice=='B'): print"Are you sure that you want to see your account balance?" get_balance() show_instructions() choice=raw_input("Enter your choice :") while (choice=='d' or choice=='D'): print"Are you sure you want to deposit money?" deposit() show_instructions() choice=raw_input("Enter your choice :") while (choice=='w' or choice=='W'): print"Are you sure you want to withdraw money?" withdraw() show_instructions() choice=raw_input("Enter your choice :") while (choice=='q' or choice=='Q'): print"YOU WANT TO QUIT" confirm = raw_input("If you agree, enter 'y' if not enter 'n': ") if confirm == 'y': end() elif confirm == 'n': show_instructions() choice=raw_input("Enter your choice :") #IF YOU TYPE ANY OTHER "LETTER" THEN THE CODE WILL BREAK! WE WANTED IT LIKE THIS #SO THAT, LIKE A REAL COMPUTER SYSTEM, IF IT WERE A COMPUTER/HACKER THEY WOULD BE #LOCKED OUT OF THE PROGRAM main()