Your function crashed on 0 as input because your function throws a "empty range for randrange() (2,0, -2)" error.
Hello. I'm a total newbie when it comes to coding, (i started learning my first language, Python, just a couple of weeks ago). And can't figure out a solution to this problem... i would really appreciate some insights Thank you
What i'm trying to do is:
import random def is_prime(x): n=random.randint(2, x-1) if x%n==0: return False elif x%n!=0: return True print is_prime(3)