Q:

Write a Python function that takes a number as a parameter and check the number is prime or not

0

Write a Python function that takes a number as a parameter and check the number is prime or not

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def test_prime(n):
    if (n==1):
        return False
    elif (n==2):
        return True;
    else:
        for x in range(2,n):
            if(n % x==0):
                return False
        return True             
print(test_prime(9))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now