Reputation: 1
I want to print prime number, but in my code print() showing invalid syntax.My question is about, I can not understand why it is showing. So please help me what should be modify needed in the code and please tell me code is wright or wrong.
def isPrime(num):
for i in range(2,num):
if num % i == 0 and num % 1 == 0:
return True
else:
return False
else:
return None
num = int(input("Enter a number:")
print(isPrime(num))
Upvotes: 0
Views: 52
Reputation: 395
You are missing a parenthesis here:
num = int(input("Enter a number:")
it should be:
num = int(input("Enter a number:"))
Upvotes: 0
Reputation: 469
num = int(input("Enter a number:")
You missed a parentheses. It should be:
num = int(input("Enter a number:"))
Upvotes: 1