Python - Methods and Behavior Definition
Consider this class:
What is the output?
class BankAccount:
def __init__(self, balance):
self.balance = balance
def deposit(self, amount):
self.balance += amount
def withdraw(self, amount):
if amount <= self.balance:
self.balance -= amount
else:
print('Insufficient funds')
def get_balance(self):
return self.balance
account = BankAccount(100)
account.deposit(50)
account.withdraw(30)
print(account.get_balance())What is the output?
