Advertisement
Guest User

ATM

a guest
Apr 5th, 2020
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.83 KB | None | 0 0
  1. import os
  2. dict={}
  3. wrong = 0
  4.  
  5. def clear():
  6.     os.system("clear")
  7.     return
  8.    
  9. def remainingBal():
  10.     print("\nYou remaining balence is: $" + str(total))
  11.     return
  12.    
  13. def mainScreen():
  14.     clear()
  15.     print("               Hello "+ name.capitalize()+"!  Welcome back!")
  16.     print("\n************************************************************")
  17.     print("\n--------------|Your total checking is: $" + str(dict[name][2])+"|---------------")
  18.     print("\nHow can I help you today?")
  19.     print("\nType 1 for deposit.\n\nType 2 for withdrawl.\n\nType 3 to exit.")
  20.     return
  21.  
  22.  
  23. while True:
  24.     print("    |**************************************************|\n    |********//\\\******============****| \*****/ |*****|\n    |*******//**\\\**********||*********||\\\***//||*****|\n    |******//****\\\*********||*********||*\\\*//*||*****|\n    |*****//******\\\********||*********||**\!/**||*****|\n    |*****||******||********||*********||*******||*****|\n    |*****| ====== |********||*********||*******||*****|\n    |*****||******||********||*********||*******||*****|\n    |*****||******||********||*********||*******||*****|\n    |*****||******||********||*********||*******||*****|\n    |**************************************************|\n\n")
  25.     acc = input("Are you an existing account holder or are you new? \nType 1 for new or 2 for existing.\n")
  26.     if acc == "1":
  27.         name = input("What is your name? ")
  28.         passw = input("Create a password. ")
  29.         passw2= input("Re-type your password. ")
  30.         if passw == passw2:
  31.             bal = input("\nHow much will you deposit in your new account? ")
  32.             dict[name] = (name,passw,bal)
  33.         else:
  34.             clear()
  35.             print("Password did not match.\nPlease try again.\n")
  36.             continue
  37.     elif acc == "2":
  38.         name = input("What is your name? ")
  39.         passw = input("What is your password? ")
  40.         if name not in dict:
  41.             clear()
  42.             print("\nWrong user name. Try again.\n\n")
  43.             continue
  44.     else:
  45.         clear()
  46.         print("Please re-enter.\n")
  47.         continue
  48.     while True:
  49.         if name == dict[name][0] and passw == dict[name][1]:
  50.             dict[name][2]
  51.             mainScreen()
  52.             inpt = input()
  53.             if inpt =="2":
  54.                 inpt2 = input("\nHow much would you like to withdrawl? $")
  55.                 total = int(dict[name][2]) - int(inpt2)
  56.                 dict2 ={name:(name,passw,total)}
  57.                 dict.update(dict2)
  58.                 remainingBal()
  59.                 mainScreen()
  60.             elif inpt =="1":
  61.                 inpt3 = input("\nHow much would you like to deposit? $")
  62.                 total = int(dict[name][2]) + int(inpt3)
  63.                 dict2 = {name:(name,passw,total)}
  64.                 dict.update(dict2)
  65.                 remainingBal()
  66.                 mainScreen()
  67.             elif inpt == "3":
  68.                 clear()
  69.                 break
  70.         else:
  71.             clear()
  72.             wrong = wrong + 1
  73.             if wrong <= 5:
  74.                 print("Wrong username or password")
  75.                 break
  76.             else:
  77.                 print("Account locked!!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement