This code will be part of a program that will check if a number is prime or not. I know it's not particularly elegant, but I want to get it working simply for experience. I think that the function is failing because the logic on the if/elif is wrong, when I run this code, it seems to just go straight to the else clause. Is this a syntax problem, or am I not allowed to do logic checks in if clauses?
list = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
def find_prime(list, n):
if n in list == False:
list.append(n)
print "I'ts in there now."
elif n in list == True:
print "It's in there already."
else:
print "Error"
find_prime(list, 3)
find_prime(list, 51)