-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicBankSystem.py
More file actions
65 lines (53 loc) · 1.63 KB
/
BasicBankSystem.py
File metadata and controls
65 lines (53 loc) · 1.63 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
def deposit(balance, amount, tr_history):
balance+= amount
tr_history.append((balance,amount))
print(f'Deposited {amount}. The new balance is {balance}')
return balance
def withdraw(balance, amount,tr_history):
if balance-amount >= 0:
balance-=amount
tr_history.append((balance,amount))
print(f'Withdrawed {amount}. The new balance is {balance}')
else:
print("Insufficient funds")
return balance
def check_balance(balance):
print(f'Balance is {balance}')
balance = 0
pin_code = 4344
tr_history = []
for i in range(2):
print("Write the pin code (****)")
pinchoice = int(input())
if pinchoice == pin_code:
while(True):
print(
'''
==============================
BANKING SYSTEM
==============================
1. Deposit Money
2. Withdraw Money
3. Check Balance
4. Exit
==============================''')
print("Choose an option: ")
choice = int(input())
if choice == 1:
print("Enter amount to deposit: ")
amount = int(input())
balance = deposit(balance, amount,tr_history)
elif choice == 2:
print("Enter amount to withdraw: ")
amount = int(input())
balance = withdraw(balance, amount,tr_history)
print(tr_history)
elif choice == 3:
print("The balance: ")
check_balance(balance)
elif choice == 4:
break
else:
print("Wrong choice")
else:
print("Try again")