Thanks!
def hello(a,b):
print "hello and that's your sum:"
sum=a+b
print sum
import sys
if __name__ == "__main__":
hello(sys.argv[2])
It does not work for me, I appreciate the help!!! Thanks!
Thanks!
def hello(a,b):
print "hello and that's your sum:"
sum=a+b
print sum
import sys
if __name__ == "__main__":
hello(sys.argv[2])
It does not work for me, I appreciate the help!!! Thanks!
Without seeing your error message it's hard to say exactly what the problem is, but a few things jump out:
probably more, but again, need the error output.
Here's what you might want:
import sys
def hello(a,b):
print "hello and that's your sum:"
sum=a+b
print sum
if __name__ == "__main__":
hello(int(sys.argv[1]), int(sys.argv[2]))
sys
in global scope, not in the end of the function.hello
, one is not enough. That should result in:
import sys
def hello(a, b):
sum = a + b
print "hello and that's your sum:", sum
if __name__ == "__main__":
hello(float(sys.argv[1]), float(sys.argv[2]))