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
Help, with gaming unlocked
Leto [7]

Answer:

C. empathic understanding

8 0
4 years ago
_____ allows a function or operator to perform different tasks depending on the types of the arguments or operands. Group of ans
xenn [34]

Polymorphism allows a function or operator to perform different tasks depending on the types of the arguments or operands.

<h3>What does polymorphism helps?</h3>

Polymorphism is known to be that which helps its users to be able to carry out one action in a lot of ways that is many forms.

Note that Polymorphism allows a function or operator to perform different tasks depending on the types of the arguments or operands and thus makes one to work faster.

Learn more about Polymorphism from

brainly.com/question/20317264

#SJ1

5 0
2 years ago
Which of the following is the fastest growing input technique​
Natali [406]
We need more information for this one, please.
8 0
3 years ago
_______ tools enable people to connect and exchange ideas.
Serggg [28]

Answer:

B

Explanation:

I'm pretty sure it's B because I mean it makes the most sense

Hope I helped a little:)

Have a nice day!!

6 0
4 years ago
Read 2 more answers
This assignment involves writing a program that models a dog. A dog has a name, a breed (which may be unknown), a gender (male o
Vinil7 [7]

Answer:

This is very complex for our users please shorten this question. Thank You

Explanation:

3 0
4 years ago
Other questions:
  • Output devices reproduce or display which of the following
    12·2 answers
  • “Artificial intelligence is the tool of education in the near future”. Research on the possibility of “AI technology” in scienti
    15·1 answer
  • Suppose we want to adjust the page numbering for our Works Cited section so that it starts over at page 1. Is this possible to d
    12·2 answers
  • Resumen sobres el correo electrónico​
    6·1 answer
  • What are some things all boomers say.
    12·2 answers
  • Question # 2 Multiple Select You wrote a program to compare the portion of drivers who were on the phone. Which statements are t
    15·1 answer
  • SOMEONE PLEASE HELP ME WITH THIS ILL GIVE YOU BRAINLY IF YOU GET IT RIGHT PLEASE!!!!!
    13·2 answers
  • Despite a wide variety of workplaces for those working in Human Services, all workplaces include
    5·1 answer
  • When i add someone to canvas course, do they get an invitation?.
    8·1 answer
  • If a while loop iterates forever,what is the most likely cause?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!