def factorial(x):

is_prime = False

if x == 1: return False

elif x == 0 or x < 0: return False

elif x == 2 or x == 3: return True

else:

n = x

while n > 3:

if x%2 == 0 or (x%n == 0 and x!= n):

n -= 1

is_prime = False

else:

n -= 1

is_prime = True

return is_prime

Can someone please tell me why I get the warning :'Your function crashed because you were trying to divide or modulo (%) by zero.'

Please note, I have found a different way of doing the problem so I am not interested in alternate solutions; just how n could ever be 0 (and produce the error) when I have the condition while n > 3 out side the modulo check?