OneCompiler

bankAccount

295
'''
Task 3
1. Implement a class called BankAccount
2. with methods for deposit
3. withdrawal,
4. and displaying the balance
'''


class BankAccount:
    def __init__(self, balance):
        self.balance = balance

    def deposit(self, amount):
        # putting money to a current balance
        self.balance += amount

    def withdraw(self, amount):
        # removing money from a current balance
        self.balance -= amount

    def info(self):
        # displaying the current balance
        print(f"The current balace is: {self.balance}")


account1 = BankAccount(100)
account1.info()
account1.deposit(500)
account1.info()
account1.withdraw(20)
account1.info()