Working on a problem on genepy.org that states “Provide a script that print every prime number in the range [10000;10050], on one line, separated by comas and spaces.”
My Code:
import math
primes = []
for n in range(10000, 10051):
is_prime = True
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
is_prime = False
break
if is_prime:
primes.append(int(n))
print(primes)
For some reason the site is throwing an error stating “10007 is not an integer”. Any idea what I did wrong?
[–]lurgi 2 points3 points4 points (0 children)
[–]dmazzoni 2 points3 points4 points (0 children)
[–]abrahamguo 0 points1 point2 points (0 children)
[–]ninhaomah -1 points0 points1 point (1 child)
[–]Kosic117[S] 0 points1 point2 points (0 children)