-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbank0.py
More file actions
31 lines (31 loc) · 893 Bytes
/
bank0.py
File metadata and controls
31 lines (31 loc) · 893 Bytes
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
import sys
class Bank(object):
def __init__(self,name,bal = 0.0):
self.name = name
self.balance = bal
def showAmt(self):
return self.balance
def deposite(self, amount):
self.balance += amount
return self.balance
def withdraw(self, amount):
if amount > self.balance:
print("Balance AMount is less, So no Withdrawal")
else:
self.balance-=amount
return self.balance
name = input("Enter Name: ")
b = Bank(name)
while (True):
print('\n\ns -ShowBalance, d -Deposite, w -Withdraw, e -Exit')
choice = input('your Choice:').lower()
if choice == 'e':
sys.exit()
if choice == 'd':
amt = float(input("Enter Amount: "))
print("Balance after Deposite: ",b.deposite(amt))
elif choice == 'w':
amt = float(input("Enter Amount: "))
print("Balance after Withdrawal: ",b.withdraw(amt))
elif choice == 's':
print("{} your Account Balance is {}".format(name,b.showAmt()))