Two Calling Conventions, Same Result
class Account:
def __init__(self, balance):
self.balance = balance
def deposit(self, amount):
self.balance += amount
return self.balance
a = Account(100)
print(a.deposit(50))
print(Account.deposit(a, 25))
print(Account.deposit(30))
What does this print, in order, for the first two lines, and what happens on the third?
Sign in to answer questions and track your progress
Sign In