For reasons unknown I am getting 0 points for it. Could someone give a clue?
primes = [True for i in range(1001)] primes[:1] = False for i in range(2,1001): if primes[i]: for k in range(i*i,1001,i): primes[k] = False N = int(input()) for i in range(N): k = int(input()) for i in range(1,k+1): if primes[i]: print(i) print()
Everybody know that number one isn’t prime, but … what about author of this problem, does [or did?] he know it?
Arek, you should carefully read example output.
I tested it on the example provided, it yields 1 and the rest.
But only test isn’t enough. You should very carefully compare yours output with that in problem. Output for 5 in problem is: 1 <==== 2 3 5
NOT 2 3 5