Jul-11-2018, 04:37 PM
The if clause should go after line 35.
If you have the primes in a list p that is a global variable, you can just do:
If you have the primes in a list p that is a global variable, you can just do:
def isPrime(i): return i in pNote that if p is a set it will be faster than if p is a list. The set can use a hash lookup, while the list has to check each item in turn.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures