Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def main_func():
- num = random.randint(0000, 9999)
- random.seed(num)
- account_identifier = random.randint(0, 9)
- check_sum = random.randint(0, 9)
- user_card = int(f"400000{random.randint(1000000, 9999999)}{account_identifier}{random.randint(0, 9)}{check_sum}")
- user_pin_card = int('{:04d}'.format(random.randrange(0000, 9999)))
- user_balance = 0
- user_data = []
- exit_from_main_cycle = False
- while not exit_from_main_cycle:
- inp_user = input("1. Create an account\n2. Log into account\n0. Exit\n>")
- print(" ")
- if inp_user == "1":
- if not user_data:
- print(f"Your card has been created\nYour card number:\n{user_card}\nEnter your PIN:\n{user_pin_card}")
- user_data.append([int(user_card), user_pin_card])
- print(" ")
- elif inp_user == "2":
- if len(user_data) != 0:
- loop_exit_condition = False
- while not loop_exit_condition:
- check_card_number = int(input("Enter your card number:\n>"))
- pin_code_check = int(input("Enter your PIN:\n>"))
- if check_card_number == user_data[0][0] and pin_code_check == user_data[0][1]:
- print(" ")
- print("You have successfully logged in!\n")
- while not loop_exit_condition:
- select_after_authorization = input("1. Balance\n2. Log out\n0. Exit\n>")
- print(" ")
- if select_after_authorization == "1":
- print(f"Balance: {user_balance}\n")
- continue
- elif select_after_authorization == "2":
- loop_exit_condition = True
- print("You have successfully logged out!")
- print(" ")
- elif select_after_authorization == "0":
- loop_exit_condition = True
- exit_from_main_cycle = True
- else:
- print("Wrong card number or PIN!")
- continue
- else:
- continue
- elif inp_user == "0":
- print("Bye!")
- break
- if __name__=="__main__":
- print(main_func())
Advertisement
Add Comment
Please, Sign In to add comment