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