Reputation: 143
In the following, why it is not printing results even though I don't see any errors:
class Test(object):
def __init__(self, x, y):
self.x = x
self.y = y
def printing(self):
var = self.x + self.y
print(" RESULT= %i " % var)
if __name__ == '__main__':
Test().printing(10, 20)
Upvotes: 0
Views: 37
Reputation: 4687
if __name__ == '__main__':
Test().printing(10, 20)
Should be
Test(10, 20).printing()
You have mistake in instance initialization.
Upvotes: 3