-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBANKDETAILED.py
More file actions
149 lines (48 loc) · 1.93 KB
/
Copy pathBANKDETAILED.py
File metadata and controls
149 lines (48 loc) · 1.93 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
class BankAccount:
def __init__(self, name, account_number):
self.bank_name = "KOTAK BANK"
self.name = name
self.account_number = account_number
self.balance = 0.0
def display_details(self):
print(f"Bank Details:")
print(f"Bank Name: {self.bank_name}")
print(f"Account Holder: {self.name}")
print(f"Account Number: {self.account_number}")
print(f"Current Balance: ${self.balance:.2f}")
def withdraw(self, amount):
if amount > 0 and amount <= self.balance:
self.balance -= amount
print(f"Withdrew ${amount:.2f}. New balance: ${self.balance:.2f}")
else:
print("Insufficient funds or invalid withdrawal amount.")
def deposit(self, amount):
if amount > 0:
self.balance += amount
print(f"Deposited ${amount:.2f}. New balance: ${self.balance:.2f}")
else:
print("Invalid deposit amount.")
# Example Usage
account_number = input("Enter your Account Number: ")
account_holder = input("Enter your Name: ")
account = BankAccount(account_holder, account_number)
while True:
print("\nSelect an option:")
print("1. Check Balance")
print("2. Withdraw")
print("3. Deposit")
print("4. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
account.display_details()
elif choice == 2:
amount = float(input("Enter withdrawal amount: "))
account.withdraw(amount)
elif choice == 3:
amount = float(input("Enter deposit amount: "))
account.deposit(amount)
elif choice == 4:
print("Exiting...")
break
else:
print("Invalid choice.")