Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def main_func():
- num = random.randint(0, 100) # Создаем на кажый раз рандомное число
- random.seed(num)
- account_identifier = random.randint(0, 9)
- check_sum = random.randint(0, 9) # для будущего продолжения сумма
- user_card = f"400000{random.randint(1000000, 9999999)}{account_identifier}{random.randint(0, 9)}{check_sum}" # Карта
- user_pin_card = random.randint(1000,9999) # Пин карты юзера
- user_balance = 0
- user_data = [] # Для хранения данных пользователя
- #print(user_card)
- 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 == "Create an account": # Выбор пользователя создать аккаунт
- if len(user_data) == 0: # чтобы не показывать данные каждую иттерацию
- 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 == "Log into account":
- #print(user_data)
- 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("You have successfully logged in!\n")
- while not loop_exit_condition:
- #print("1. Balance\n2. Log out\n0. Exit")
- select_after_authorization = input("1. Balance\n2. Log out\n0. Exit\n>")
- print(" ")
- if select_after_authorization == "Balance": # Если нужем баланс смотри и продолжаем работу
- print(f"Balance: {user_balance}\n")
- continue
- elif select_after_authorization == "Log out": # Если нужем выйти в начальное меню
- loop_exit_condition = True # Выход из цикла
- elif select_after_authorization == "Exit":
- loop_exit_condition = True # Выход из циклов
- exit_from_main_cycle = True # Выход главного(внешнего цикла) из цикла
- # Если данные не правильные возвращаемся в главное меню
- else:
- print("Wrong card number or PIN!")
- continue
- else:
- continue
- elif inp_user == "Exit":
- break
- if __name__=="__main__":
- print(main_func())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement