10.py
375 Bytes
#!/usr/bin/python
import sys;
import math;
def isPrime(num):
if(num == 1):
return False;
for i in range (2, int(math.floor(math.sqrt(num)))+1):
if ((num % i) == 0):
return False;
return True;
def sumPrimes(num):
sum = 0;
for i in range (1,num):
if(isPrime(i)):
sum += i;
return sum;
pos = int(sys.argv[1]);
print "Result is: " + str(sumPrimes(pos));