-
Notifications
You must be signed in to change notification settings - Fork 0
/
class-bank.py
35 lines (34 loc) · 998 Bytes
/
class-bank.py
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
class Bank:
def _init_(self):
self.balance=0
print('-create an account-')
self.name=input("enter name:")
self.accntno=int(input("enter account number:"))
self.typeof=input("enter type of account:")
def deposit(self):
amount=int(input("enter amount to deposit"))
self.balance+=amount
print("amount deposited ",amount)
def withdraw(self):
amount=int(input("enter amount to withdraw:"))
if self.balance>=amount:
self.balance-=amount
print("amount withdrawn:",amount)
else:
print("insufficient amount")
def display(self):
print("account balance:",self.balance)
a=Bank()
a._init_()
while(1):
print("\n1.deposit\n2.withdraw\n3.balance\n4.exit\n")
ch=int(input("enter choice"))
if ch==1:
a.deposit()
elif ch==2:
a.withdraw()
elif ch==3:
a.display()
else:
print('wrong choice')
exit()