In this example we will show how to modify properties on class objects in Python.
Source Code
class Sum:
def __init__(self, a, b):
self.a = a
self.b = b
def my_function(self):
s = self.a + self.b
print(s)
sum1 = Sum(2, 6)
print(sum1.a)
sum1.a = 10
print(sum1.a)
Output:
2
10