class Chain def __init__ self self __a def plus self self __a return s

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class Chain:
def __init__(self, a):
self.__a = a
def plus(self, b):
self.__a += b
return self
def minus(self, b):
self.__a += b
return self
def result(self):
print(f'Result is { self.__a }')
a=Chain(5)
b=Chain(13)
a.minus(2).plus(3).result()
b.plus(2).plus(3).minus(10).result()