-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmock atm opt.py
94 lines (65 loc) · 2.28 KB
/
mock atm opt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import random
database = database_user = {
'Mark':'markanthony',
'Lebron':'lebronjames',
'Donald':'donaldtrump'
}
def init():
print("Welcome to Bankcardano")
have_account = int(input("Do you have an account with us: 1(Yes) 2 (No) \n"))
if (have_account == 1):
login()
elif (have_account == 2 ):
register()
else:
print("You have selected an invalid option")
init()
def login():
print("Sign in")
user_account_number = int(input("What is your account number? \n"))
password = input("What is your password \n")
for user_details, account_number in database.items():
if (account_number == user_account_number):
if (user_details[3] == password):
bank_operations(user_details)
print("Invalid password")
login()
def register():
print("*********Register************")
email = input("Email Address \n")
first_name = input("First Name \n")
last_name = input("Last Name \n")
address = input("Residential Address \n")
nationality = input("Nationality \n")
number = input("Phone Number \n")
password = input("Password \n")
account_number = generate_account_number()
database[account_number] = [email, first_name, last_name, address, nationality, number,password]
print("Your account has been created")
print("Your account number is: %d" % account_number)
print("Do not disclose this to anyone")
login()
def bank_operations(user):
print("Welcome %s %s " % (user[1], user[2]))
selected_option = int(input("What would you like to do? (1) Withdrawal (2) Deposit (3) Logout (4) Exit \n"))
if(selected_option == 1):
withdrawal_option()
elif(selected_option == 2 ):
deposit_option()
elif(selected_option == 3):
logout()
elif(selected_option == 4):
exit()
else:
print("Invalid option selected")
bank_operations(user)
def withdrawal_option():
print("Withdrawal")
def deposit_option():
print("Deposit")
def generate_account_number():
return random.randrange(1111111111,9999999999)
print (generate_account_number())
def logout():
login()
init()