I keep getting this error message but think I have is_prime defined on line 3.
Oops, try again.
Did you create a function called is_prime? Your code threw a "global name 'is_prime' is not defined" error.
I expect the first if clause to check if the number entered is 2 or less than 2. The second to check if number entered is 3. And the else to work with all numbers above 3.
n = raw_input('Insert your number!') def is_prime(x): if x < 2: return False elif x == 3: return True else: for num in range(3,(x-1)): if x\num == 0: return False else: return True
Any help would be greatly appreciated. Until now I was trundling along nicely but I've been stuck here a few days now.