Python For All
Topics
(Move to ...)
Home
▼
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
‹
›
Home
View web version
No comments:
Post a Comment