bank account program in python oop

Solutions on MaxInterview for bank account program in python oop by the best coders in the world

showing results for - "bank account program in python oop"
Diego
26 Apr 2017
1class Bank:
2
3    def __init__(self,name,balance=0):
4        self.name = name
5        self.balance = balance
6
7    def withdraw(self,amount):
8        if amount<self.balance:
9            self.balance -= amount
10            print(self.name,self.balance)
11            
12        else:
13            print("Not Enough Money for Withdraw...\nYour account has",self.balance,".")
14
15    def deposit(self,amount):
16        self.balance += amount
17        return self.balance
18
19
20
21b = Bank("Zulqarnain")
22b.deposit(1000)
23b.withdraw(200)
24
25
26