I am getting an error saying local variable 'a' is referenced before assignment. I assume this is because I am defining 'a' as another variable x.
I am trying to use a while loop to create my program. I want to set 'a' equal to x and then test x/(a-1) for divisibility and finally decreasing a by 1.
def is_prime(x): x=a while a>=1: if x%(a-1)==0: a-=1 return False else: return True