I am a new python user. Thus it might be very silly. But what is the best way to run a class automatically (which has several functions inside) and return the result for a given value. for example:
class MyClass():
def __init__(self,x):
self.x=x
def funct1(self):
return (self.x)**2
##or any other function
def funct2(self,y):
return y/100.0
##or any other function
def wrapper(self):
y=self.funct1()
z=self.funct2(y)
##or other combination of functions
return z
Right now to run this, I am using:
run=MyClass(5)
run.wrapper()
But I want to run like this:
MyClass(5)
Which will return a value and can be saved inside a variable with out needing to use the wrapper function.