Define a function is_prime that receives an integer argument and returns true if the argument is a prime number and otherwise returns false. (an integer is prime if it is greater than 1 and cannot be divided evenly [with no remainder] other than by itself and one. for example, 15 is not prime because it can be divided by 3 or 5 with no remainder. 13 is prime because only 1 and 13 divide it with no remainder.) this function may be written with a for loop, a while loop or using recursion.

Respuesta :

Study the for statement carefully!

```
#!/usr/local/bin/python3

import sys, math

def is_prime( number ):
    if( number % 2 == 0 ):
        return False
    else:
        for i in range( 3, int( math.sqrt( number ) ) + 1, 2 ):
            if( number % i == 0 ):
                return False
        return True


if( __name__ == "__main__" ):
    if( len( sys.argv ) != 2 ):
        sys.stderr.write( "\nusage: " + sys.argv[ 0 ] + " <integer>\n\n" )
        exit( 127 )

    print( is_prime( int( sys.argv[ 1 ] ) ) )
```

The program is an illustration of loops.

Loops are used to carry out repetition operations; examples are the for-loop and the while-loop.

The program in Python, where comments are used to explain each line is as follows:

#This defines the function

def is_prime(num):

   #This iterates from 2 to the number

   for i in range(2,num):

       #If the number has a factor

       if( num % i == 0 ):

           #This returns False

           return False

           #And the loop is exited

           break

   #If there are no factors

   else:

       #This returns True

       return True

The above program is implemented using a for loop

Read more about similar programs at:

https://brainly.com/question/15263759