Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
1.1 kB
0
Indexable
Never
class Bank_account:
    def __init__(self,account_holder,initial_balance):
        self.account_holder=account_holder
        self.balance=initial_balance

    def deposit(self,amount):
         self.balance += amount
    #print("amount will be deposited successfully")

    def withdraw(self,amount):
        if amount > self.balance:
            print("insufficiant balance")
        else:
            self.balance -= amount
            
    def get_balance(self):
        return self.balance

    def get_account_holder(self):
        return self.account_holder

    def set_account_holder(self,new_holder):
        self.account_holder=new_holder

    def perform_bank_operation(self):
        print("welcome to hdfc bank")
        print("account holder name is",self.account_holder)
        print("current balance is ",self.balance)



std=Bank_account("mansi fulpagar",10000)
std.deposit(500)
std.withdraw(2000)
# abc=std.get_balance()
# print("current balance is ",abc)
std.perform_bank_operation()
std.set_account_holder("Akash gaikwad")
print("new account holder name is",std.get_account_holder())
Leave a Comment