A method call with one extra value
Predict the output · Medium · §11.2 Drawing the blueprint
Predict the output without running the code.
Code
class Profile:
def __init__(self, name):
self.name = name
self.followers = 0
def follow(self):
self.followers += 1
p = Profile("sora")
p.follow()
print(p.name, p.followers)
p.follow(2)
print(p.name, p.followers)Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.