Monday, 24 June 2019

sum of two numbers using commandline arguments


#sum of two numbers
import sys
a=sys.argv
#convert arguments into two nuers
#sum=int(sys.argv[1])+int(sys.argv[2])
sum=int(a[1])+int(a[2])
print(sum)
"""
F:\Programs>cd command
F:\Programs\command>python 2.py 2 4
6

No comments:

Post a Comment

Files with Exception handling

#Ask the user to take two input integer values var a,b try:     a=int(input("enter any integer value:"))     b=int(input(&qu...