Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Bank management system
- import getpass
- import sys
- User_Db = {'sanpai':'Admin123','anabharat':'Admin1234'}
- count = 0
- def logon(User_Db):
- u_name=input("Enter the username : ")
- print("\n")
- p_word=getpass.getpass("Enter Password : ")
- print("\n")
- return User_Db.get(u_name,None) == p_word
- # print(u_name)
- # print (p_word)
- for r in range(20):
- print("*",end=" ")
- print("\n")
- print("\t WELCOME TO BMS \t",end = " ")
- print("\n")
- for r in range(20):
- print("*",end=" ")
- print("\n")
- for i in range(3):
- if logon(User_Db):
- print ("Authentication Successful ...")
- print ("\n")
- break
- else:
- if count == 2:
- print ("Account Locked Contact Admin ")
- print("\n")
- sys.exit()
- else:
- print ("Authentication failure please relogin ")
- print("\n")
- count+=1
- for r in range(20):
- print("*",end=" ")
- print("\n")
- while True:
- print("1. ACCOUNT ")
- print("2. TRANSCATIONS ")
- print("3. REPORTS ")
- print("4. EXIT ")
- print("\n")
- try:
- choice=int(input("Enter Your choice : "))
- except ValueError:
- print("Enter a choice between 1 and 4")
- if choice == 1:
- while True:
- print("1. Add Account")
- print("2. Update Account ")
- print("3. Delete Account ")
- print("4. Goto Main Menu ")
- print("5. Exit ")
- try:
- choice=int(input("Enter Your choice : "))
- except ValueError:
- print("Enter a choice between 1 and 5")
- if choice == 1:
- try:
- fp = open("Accounts.txt","a")
- except IOError:
- print("File error , try again")
- Name = input("Enter your name : ")
- Mob_num = input ("Enter Mobile number : ")
- fp.write('%s \t\t %s \t\t %d \t\n'%(Name,Mob_num,0))
- print("account added succesfully ,maintain an minimum balance of INR 3000")
- fp.close()
- elif choice == 2:
- print("To be done ")
- elif choice == 3:
- print("To be done ")
- elif choice == 4:
- print("To be done ")
- elif choice == 5:
- sys.exit()
- else:
- print("Enter a choice between 1 and 5")
- elif choice == 2:
- print("1. Deposit")
- print("2. Withdraw ")
- print("3. Goto Main Menu ")
- print("4. Exit")
- try:
- ch=int(input("Enter Your choice : "))
- except ValueError:
- print("Enter a choice between 1 and 4")
- elif choice == 3:
- print("Reports")
- elif choice == 4:
- sys.exit()
- else:
- print("Enter a choice between 1 and 4")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement