Answer the question
In order to leave comments, you need to log in
Why doesn't the program start in Google colab?
Why won't the program start? Can't figure out what's wrong?
import math
from time import per_counter
from numba import njit, prange
@njit(fastmath=True, cache=True)
def is_prime(num):
if num == 2:
return True;
if num <= 1 or not num % 2:
return False
for div in range(3,int(math.sqrt(num)+1),2):
if not num % div:
return False
return True
@njit(fastmath=True, cache=True,parallel=True)
def run program(N):
for i in prange(N):
is_prime(i)
if __name__ == ‘__main__’:
N = 10000000
start = perf_counter()
run_program(N)
end = perf_counter()
print (end — start)
File "<ipython-input-23-ee7e604e49c3>", line 14
@njit(fastmath=True, cache=True,parallel=True):
^
SyntaxError: invalid syntax
File "<ipython-input-24-bf748f6df3cf>", line 15
def run program(N):
^
SyntaxError: invalid syntax
Answer the question
In order to leave comments, you need to log in
Do not put a colon after the decorator, this is not a function
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question