Write program to find sum of even numbers using command line arguments
import sys
sum=0
args=sys.argv
print("All arguments one by one")
for x in args:
print(x)
n=len(sys.argv)
j=1
while(j<=n-1):
y=int(sys.argv[j])
if(y%2==0):
sum=sum+y
j=j+1
print("Sum is ",sum)
import sys
sum=0
args=sys.argv
print("All arguments one by one")
for x in args:
print(x)
n=len(sys.argv)
j=1
while(j<=n-1):
y=int(sys.argv[j])
if(y%2==0):
sum=sum+y
j=j+1
print("Sum is ",sum)