Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import string
- import random
- import time
- lst = []
- lst1 = []
- lstDeposit = []
- lstWithdrawal =[]
- def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
- return ''.join(random.choice(chars) for _ in range(size))
- class user:
- def __init__(self, name, surname, password, deposit ,withdrawal , total):
- self.name = name
- self.surname = surname
- self.password = password
- self.deposit = deposit
- self.withdrawal = withdrawal
- self.total = total
- def login():
- user_id = input("\nIdentifier: ")
- User = user(input("name: "), input("surname: "), input("password: "), deposit = 0, withdrawal = 0, total = 0)
- lst1.append([user_id,User.name,User.surname,User.password])
- for i in range(len(lst)):
- if lst[i] == lst1[0]:
- print("\nAccessing the account of " + User.name + "...")
- time.sleep(1)
- print("access executed")
- time.sleep(1)
- while True:
- print("\nSelect an action:\nDeposit (1) \nPrint your total (2) \nWithdrawal (3)\nPrint all your withdrawals (4)\nPrint all your deposits (5) \nPrint your total (6) \nLogout (7)")
- action = input(":")
- if action == "1":
- User.deposit = input("deposit: ")
- lstDeposit.append(User.deposit)
- if action == "2":
- total = int(User.deposit) - int(User.withdrawal)
- print(total)
- if action == "3":
- User.withdrawal = input("withdrawal: ")
- lstWithdrawal.append(User.withdrawal[i])
- if action == "4":
- try:
- for word in lstWithdrawal:
- print(lstWithdrawal[i])
- except IndexError:
- print("you don't have any deposit")
- if action == "5":
- try:
- for word in lstDeposit:
- print(lstDeposit[i])
- except IndexError:
- print("you don't have any deposit")
- if action == "6":
- total = int(User.deposit) - int(User.withdrawal)
- print(total)
- if action == "7":
- del lst1[:]
- start()
- else:
- print("wrong credentials")
- del lst1[:]
- start()
- def makeUser():
- i = 1
- while i > 0:
- User = user(input("\nname: "), input("surname: "), input("password: "), deposit = 0, withdrawal = 0, total = 0)
- user_id = id_generator()
- lst.append([user_id,User.name,User.surname,User.password])
- time.sleep(0.5)
- print("\nadding new user..")
- time.sleep(1)
- print("User " + User.name + " add.")
- print("User identifier: " + user_id)
- i += 1
- start()
- def start1():
- print("starting...")
- start()
- def start():
- time.sleep(1.5)
- print("\nSelect an action:\nAdd new user (1)\nLogin (2)\nExit (3)")
- action = input(":")
- if action == "1":
- makeUser()
- elif action == "2":
- login()
- elif action == "3":
- print("whish you a good day")
- raise SystemExit
- start1()
Add Comment
Please, Sign In to add comment