I have a python file which contains the below code
test.py
def sum(a, b):
print(a+b)
def final():
print("Hello")
sum(10, 9)
if __name__=="__main__":
final()
Now when I run from the command line
python test.py
I get
Hello
19
Now I want to add a function say
which will be called separately from the command line.How do I do it?So my updated code will be
def sum(a, b):
print(a+b)
def say():
print("Yes!!!")
def final():
print("Hello")
sum(10, 9)
if __name__=="__main__":
final()
So now I want to call the function say
seperately.I tried doing this
python test.py say
But it only outputs the previous result.How can I make this work?