-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
83 lines (77 loc) · 2.94 KB
/
main.py
File metadata and controls
83 lines (77 loc) · 2.94 KB
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
from register import *
from bank import *
status = False
print("Welcome to The Banking Project")
while True:
try:
register = int(input("1. SignUp\n"
"2. SignIn"))
if register == 1 or register == 2:
if register == 1:
SignUp()
if register == 2:
user = SignIn()
status = True
break
else:
print("Please Enter Valid Input From Options")
except ValueError:
print("Invalid Input Try Again with Numbers")
account_number = db_query(
f"SELECT account_number FROM customers WHERE username = '{user}';")
while status:
print(f"Welcome {user.capitalize()} Choose Your Banking Service\n")
try:
facility = int(input("1. Balance Enquiry\n"
"2. Cash Deposit\n"
"3. Cash Withdraw\n"
"4. Fund Transfer\n"
"5. Exit\n "
))
if facility >= 1 and facility <= 5:
if facility == 1:
bobj = Bank(user, account_number[0][0])
bobj.balanceequiry()
elif facility == 2:
while True:
try:
amount = int(input("Enter Amount to Deposit"))
bobj = Bank(user, account_number[0][0])
bobj.deposit(amount)
mydb.commit()
break
except ValueError:
print("Enter Valid Input ie. Number")
continue
elif facility == 3:
while True:
try:
amount = int(input("Enter Amount to Withdraw"))
bobj = Bank(user, account_number[0][0])
bobj.withdraw(amount)
mydb.commit()
break
except ValueError:
print("Enter Valid Input ie. Number")
continue
elif facility == 4:
while True:
try:
receive = int(input("Enter Receiver Account Number"))
amount = int(input("Enter Money to Transfer"))
bobj = Bank(user, account_number[0][0])
bobj.fundtransfer(receive, amount)
mydb.commit()
break
except ValueError:
print("Enter Valid Input ie. Number")
continue
elif facility == 5:
print("Thanks For Using Banking Services")
status = False
else:
print("Please Enter Valid Input From Options")
continue
except ValueError:
print("Invalid Input Try Again with Numbers")
continue