PCAP • Practice Test 37
Free PCAP practice test — 15 questions with explanations. Set 37. No signup required.
Refer to the exhibit. What is the output?
class A:
def __init__(self, val):
self.val = val
def __add__(self, other):
return A(self.val + other.val + 1)
def __str__(self):
return str(self.val)
a = A(1)
b = A(2)
c = a + b
print(c)