def is_prime(n): if n>1: divs=[k for k in range(2,n) if n%k==0] return len(divs)==0 else: return False def nth_prime(n): primes=[p for p in range(n*n+2) if is_prime(p)] return primes[n-1]