-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBank.py
More file actions
83 lines (73 loc) · 2.33 KB
/
Bank.py
File metadata and controls
83 lines (73 loc) · 2.33 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
class Bank:
def __init__(self):
self.bal = 50000
self.pwd = 0
self.acc = 220305510
def deposit(self, var1):
print("Enter Password: ")
self.pwd = int(input())
if self.pwd == 3700:
self.bal += var1
print(f"Now you can deposit: {var1}Rs")
print(f"Total balance: {self.bal}Rs")
else:
print("Incorrect password")
def withdraw(self, var1):
print("Enter Password: ")
self.pwd = int(input())
if self.pwd == 3700:
self.bal -= var1
print(f"Now you Withdraw: {var1}Rs")
print(f"Total balance: {self.bal}Rs")
else:
print("Incorrect password")
def check_balance(self):
print("Enter Password: ")
self.pwd = int(input())
if self.pwd == 3700:
print(f"Total balance: {self.bal}Rs")
else:
print("Incorrect password")
def transfer(self, var1):
print("Enter Password: ")
self.pwd = int(input())
print("Enter account : ")
self.acc = int(input())
if self.pwd == 3700:
if self.acc == 220305510:
print(f"Before Amount transfer balance: {self.bal}Rs")
print(f"Now you Transfer: {var1}Rs")
self.bal -= var1
print(f"After Amount transfer balance: {self.bal}Rs")
else:
print("Invalid account Number you entered")
else:
print("Incorrect password")
def main():
BK = Bank()
ch = 0
print("1.Deposit :")
print("2.Withdraw :")
print("3.Check Balance :")
print("4.Transfer Money :")
print("Enter Your Choice :")
# Taking input from the user: deposit, withdraw, check_balance, transfer
ch = int(input())
if ch == 1:
print("Enter How much Amount deposit you : ")
var1 = int(input())
BK.deposit(var1)
elif ch == 2:
print("Enter How much Amount withdraw you : ")
var1 = int(input())
BK.withdraw(var1)
elif ch == 3:
BK.check_balance()
elif ch == 4:
print("Enter How much Amount you want to Transfer : ")
var1 = int(input())
BK.transfer(var1)
else:
print("You chose a service not available right now. Try again!")
if __name__ == "__main__":
main()