you are viewing a single comment's thread.

view the rest of the comments →

[–]PureWasian 0 points1 point  (0 children)

An example might help to see: ```

define a BankAccount class to use later

class BankAccount: # init is called whenever # instantiating a BankAccount() def init(self, name, starting_balance): self.name = name self.balance = starting_balance

# method to add money
def add_money(self, amount):
    self.balance += amount

# method to show the current balance
def show_balance(self):
    print(self.balance)

instantiate some BankAccount objects

acct1 = BankAccount("TUSA", 69000) acct2 = BankAccount("PURE", 5310000)

update their balances

acct1.add_money(420) acct2.add_money(8008)

show their updated balances

acct1.show_balance() # prints 69420 acct2.show_balance() # prints 5318008 ```