Write a Python function that takes a number as a parameter and check the number is prime or not
I have used python 3.7 compiler for debugging purpose.
def test_prime(num): if (num==1): return False elif (num==2): return True; else: for x in range(2, num): if(num % x==0): return False return True print(test_prime(167))
Result:
True
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
I have used python 3.7 compiler for debugging purpose.
Result:
True
need an explanation for this answer? contact us directly to get an explanation for this answer