hours ago!
When I run this code it does not exits, my laptops cooling fan starts spinning after some time of running the script!
what error do I have in the code?
Thanks
import math
def is_prime(num, primes_list):
i = 0
while i < len(primes_list) and primes_list[i] <= math.sqrt(num):
if num % primes_list[i] == 0:
return False
return True
primes = [2]
j = 3
while j < 1000:
if is_prime(j, primes):
primes.append(j)
j = j+2
print("Found: "+str(len(primes)))
you forgot to add 1 to i
Lul me 😂 tnx
where should I enter the line pls
after if num ... statement
Обсуждают сегодня