-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode
More file actions
63 lines (48 loc) · 1.66 KB
/
Copy pathcode
File metadata and controls
63 lines (48 loc) · 1.66 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
class BankAccount:
def __init__(self, acc_no, username, balance=0):
self.acc_no = acc_no
self.username = username
self.balance = balance
def deposit(self, amount):
self.balance += amount
print(f"₹{amount} deposited successfully.")
def withdraw(self, amount):
if amount > self.balance:
print("Insufficient balance!")
else:
self.balance -= amount
print(f"₹{amount} withdrawn successfully.")
def check_balance(self):
print(f"Current balance: ₹{self.balance}")
def print_details(self):
print("\n--- Account Details ---")
print(f"Account Number : {self.acc_no}")
print(f"Account Holder : {self.username}")
print(f"Final Balance : ₹{self.balance}")
acc_no = input("Enter Account Number: ")
username = input("Enter Account Holder Name: ")
account = BankAccount(acc_no, username)
while True:
print("\n--- Bank Menu ---")
print("1. Deposit")
print("2. Withdraw")
print("3. Check Balance")
print("4. Account Details")
print("5. Exit")
choice = input("Enter your choice: ")
if choice == "1":
amount = float(input("Enter amount to deposit: "))
account.deposit(amount)
elif choice == "2":
amount = float(input("Enter amount to withdraw: "))
account.withdraw(amount)
elif choice == "3":
account.check_balance()
elif choice == "4":
account.print_details()
elif choice == "5":
print("\nThank you for using our bank system!")
account.print_details()
break
else:
print("Invalid choice! Please try again.")