Write a Python function isPrime(number) that determines if the integer argument number is prime or not. The function will return a boolean True or False. Next, write a function HowManyPrimes(P), that takes an integer P as argument and returns the number of prime numbers whose value is less than P. And then write a function HighestPrime(K) that takes integer K as an argument and returns the highest prime that is less than or equal to K.

Respuesta :

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))