Nov-30-2016, 07:25 AM
All,
I'd really appreciate some help here. I'm trying to learn Python from a book and in one section they put the function you see below. So I decided I'd go "off book" and try to make up a simple little program on my own. From what I can read in the book this should work but I keep getting a syntax error after this part
I've tried all kinds of permutations with no luck and I asked a friend at work (NOT a programmer but kinda like me) and he wasn't helpful either.
Any advice will be appreciated,
Thanks
Paul
I'd really appreciate some help here. I'm trying to learn Python from a book and in one section they put the function you see below. So I decided I'd go "off book" and try to make up a simple little program on my own. From what I can read in the book this should work but I keep getting a syntax error after this part
if (checkIfPrime) == False:with the colon highlighted.
I've tried all kinds of permutations with no luck and I asked a friend at work (NOT a programmer but kinda like me) and he wasn't helpful either.
Any advice will be appreciated,
Thanks
Paul
def checkIfPrime(number): for x in range (2, number): if (number%x == 0): return False return True number = int (input ("What number would you like to check to see if it's a prime number?") if (checkIfPrime) == False: print ("The number ", number ," is not a Prime number.") else: print ("Congratulations! The number ", number ," is a Prime number.")