1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Genrish500 [490]
3 years ago
9

Define a function is_prime that receives an integer argument and returns true if the argument is a prime number and otherwise re

turns 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.
Computers and Technology
1 answer:
Mrac [35]3 years ago
8 0
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 ] ) ) )
```

You might be interested in
Why is formatting important with a table?
Crazy boy [7]

Answer:

Explanation:

it is important to be succinct, and help the reader to find the information that they need quickly, and without wading through reams of superfluous information.  formatting of table plays an important role in presenting the data clearly and scuccinctly.

7 0
3 years ago
When you use the Filter feature, what appears in each column label
Scrat [10]
<span>an arrow  ..............................</span>
5 0
4 years ago
1 Which one of the following is a transmission
ElenaW [278]

Answer:

d

Explanation:

All of the above can be means by which signals or information is transferred.

5 0
2 years ago
Which of these statements is true? agile is a programming language sql is a database language html stands for "hypertext markup
77julia77 [94]
Sql is a database language
7 0
3 years ago
Read 2 more answers
How to help poeple on brainly
Neko [114]

Answer their questions and if you don't get their questions, make sure to ask them out it to clarify it

3 0
2 years ago
Other questions:
  • How do u change the level of education on Brainly. cuz i just finished elementry
    9·2 answers
  • If you delete a file from removable media, it is stored in the recycle bin where you can recover it until you empty the recycle
    13·1 answer
  • Access Control can be defined as putting controls (or countermeasures) in place to help achieve information security goals. Whic
    13·2 answers
  • A) A cable that is mainly used in the cable television network
    11·1 answer
  • When an interrogator speaks highly about how a crime was committed, hoping to get the suspect to brag about his or her involveme
    7·2 answers
  • To ensure that comments identify the initials of the person making changes, you would need to _____.
    5·2 answers
  • Complete the implementation of the following methods:__init__hasNext()next()getFirstToken()getNextToken()nextChar()skipWhiteSpac
    11·1 answer
  • Super computer in nuclear energy ​
    13·1 answer
  • Given six memory partitions of 300 KB, 600 KB, 350 KB, 200 KB, 750 KB, and 125 KB (in order). The memory allocation algorithm th
    14·1 answer
  • Often, a single source does not contain the data needed to draw a conclusion. It may be necessary to combine data from a variety
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!