-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminiproject01.py
More file actions
57 lines (42 loc) · 1.57 KB
/
Copy pathminiproject01.py
File metadata and controls
57 lines (42 loc) · 1.57 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
#------------------------------------------------------------------------------------------------------------------
#--------------------------------------------Bank Manangement System-----------------------------------------------
#------------------------------------------------------------------------------------------------------------------
class BankAccount:
def __init__(self,name,balance=0):
self.name = name
self.__balance = balance
def deposit(self,amount):
self.__balance += amount
print("Amount deposited successfully")
def withdraw(self,amount):
if amount <= self.__balance:
self.__balance -= amount
print("Withdrawal Successful")
else:
print("Insufficient Balance")
def checkbalance(self):
print("User:",self.name)
print("Balance:",self.__balance)
name = input("Enter Account Holder's Name :")
acc = BankAccount(name)
while True:
print("\n====================Bank Management System========================")
print("1.Deposit")
print("2.Withdraw")
print("3.CheckBalance")
print("4.Exit")
choice = int(input("Enter your choice:"))
if choice == 1:
amount = float(input("Enter amount:"))
account.deposit(amount)
elif choice == 2:
amount = float(input("Enter amount:"))
account.withdraw(amount)
elif choice == 3:
account.check_balance()
elif choice == 4:
print("Thank you for using the Bank Management System")
break
else:
print("Invalid Choice!")
#---------------------------------------------------------------------------------------------------------------------