forked from Vengence1005/Coding-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bank.py
30 lines (27 loc) · 975 Bytes
/
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
import sys
class Bank():
def __init__(self , name,balance = 0.00):
self.name = name
self.balance = balance
def deposit(self,amount):
self.balance+=amount
return self.balance
def withdraw(self,amount):
if amount > self.balance:
print("You dont have sufficient balance")
else:
self.balance-= amount
return self.balance
name = input("Enter your name: ")
b = Bank(name)
while (True):
print(" d - deposit , w - withdraw , e - exit: ")
choice = input("")
if choice == "e" or choice == "E":
sys.exit()
else:
amt = int(input("Enter amount: "))
if choice == "d" or choice == "D":
print("{} {} has been deposited in your account".format( name, b.deposit(amt)))
elif choice == "w" or choice == "W":
print("{} {} has been withdrawn from your account".format(name, b.withdraw(amt)))