how to call a method with -- at runtime in python (like shell script) with run time arguments for example below file name is mathematics.py
class maths():
pass
def add(self, *args):
sum = 0
for x in args:
sum = sum + x
return sum
def mult(self, *args):
if args:
mul = 1
for x in args:
mul = mul * x
return mul
else:
return None
m = maths()
m.add(1,2,3,)
m.mult(1,2,3)
i would like to run this as :
python mathematics.py --add 1 2 3
or
python mathematics.py --mult 1 2 3