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
atroni [7]
3 years ago
9

Given a positive integer n, assign true to is_prime if n has no factors other than 1 and itself. (remember, m is a factor of n i

f m divides n evenly.)
Mathematics
2 answers:
yawa3891 [41]3 years ago
6 0
This is the following condition in order to get the specific output for this specific problem: if is_a_prime(n):<span>    is_prime = True</span> <span><span>Now all you have to do is write is_a_prime().

For the hard code for this problem:

</span>if n == 2:<span>
is_prime = True
elif n % 2 == 0:
is_prime = False
else:
is_prime = True 
for m in range (3, int (n * 0.5) + 1, 2): 
if n % m == 0: 
is_prime = False 
<span>break.</span></span></span> 
<span>
To add, a high-level programming language that is widely used for general-purpose programming<span>, created by Guido van Rossum and first released in 1991 is called Python.</span></span>
vlada-n [284]3 years ago
3 0

Below is the solution of assign true to is_prime if n has no factors other than 1 and itself.

<h3>Further explanation </h3>

Python is an interpreted, high-level, general-purpose programming language. Python is created by Guido van Rossum and first released in 1991. Its design philosophy emphasizes code readability. Python is a more productive language than Java because it is an interpretive language which is accompanied by elegant syntax and it makes an excellent choice for scripting and rapid application development in many areas. Python is a general-purpose, versatile and popular because it is concise and easy to read, and it is also a good language to have in any programmer’s stack as it can be used for everything such as web development, software development, data science applications.

Given a positive integer n, assign true to is_prime if n has no factors other than 1 and itself. And remember, m is a factor of n if m divides n evenly. So:

<em> if n == 2: </em>

<em>is_prime = True </em>

<em>elif n % 2 == 0: </em>

<em>is_prime = False </em>

<em>else: </em>

<em>is_prime = True </em>

<em>for m in range (3, int(n**0.5)+1, 2): </em>

<em>if n % m == 0: </em>

<em>is_prime = False</em>

<h3>Learn more</h3>
  1. Learn more about python brainly.com/question/4331067
  2. Learn more about python IDLE or similar environment  brainly.com/question/6280029
  3. Learn more about python function brainly.com/question/9806744

<h3>Answer details</h3>

Grade:  9

Subject:  mathematics

Chapter:  python

Keywords:  python, integer, factors, python IDLE, <em>is_prime</em>

You might be interested in
Which line shows theINITIAL error in volume work?
aliina [53]

In step 2, V = \frac{4}{3}(3.14)(37.5) show the error in volume work.

Solution:

Given data:

The steps shows it is sphere.

Radius of the sphere = 12.5

The value of π = 3.14

Volume of the sphere = \frac{4}{3} \pi r^3

Step 1:

$V=\frac{4}{3} (3.14)(12.5)^3

$V=\frac{4}{3} (3.14)(12.5)(12.5)(12.5)

Step 2:

$V=\frac{4}{3} (3.14)(1953.125)

Step 3:

$V=\frac{4}{3} (6132.81)

Step 4:

V = 8177.08 cubic units

This is the correct solution.

But in the given options, in step 2, 12.5 is multiplied by 3.

That is not the correct step. You have to do 12.5 × 12.5 × 12.5.

Hence in step 2, V = \frac{4}{3}(3.14)(37.5) show the error in volume work.

7 0
3 years ago
With one method of a procedure called acceptance sampling, a sample of items is randomly selected without replacement and the en
GuDViN [60]

Answer:

P = 0.1447

Step-by-step explanation:

Given

n = 7000 -- total

d = 180 --- defective

r = 6 --- selected

Required

The probability of rejecting the batch

This means that at least one of the selected piece is defected.

So, we first calculate the probability that all the selected piece are accepted.

So, we have:

Pr = \frac{7000 - 180}{7000} * \frac{6999 - 180}{6999}* \frac{6998 - 180}{6998}* \frac{6997 - 180}{6997}* \frac{6996 - 180}{6996}* \frac{6995 - 180}{6995}

The denominator decreases by 1 because it is a probability without replacement; 180 is subtracted from the numerator to represent the number of non-defective CDs

So, we have:

Pr = \frac{6820}{7000} * \frac{6819}{6999}* \frac{6818}{6998}* \frac{6817}{6997}* \frac{6816}{6996}* \frac{6815}{6995}

Pr = 0.8553

Using the complement rule, the probability that the batch will be rejected is:

P = 1 - 0.8553

P = 0.1447

8 0
2 years ago
Use trianglePQR to write the trigonometric ratio as a decimal. round to four decimal places.
astraxan [27]
I hope this answer helps, it’s kinda messy, but it’s still understandable (I guess)

4 0
3 years ago
A radius of 8.5m what is the area
Debora [2.8K]

Answer:

22/7 * 8.5 * 8.5 = answer

5 0
2 years ago
Read 2 more answers
Please help me with this question in the picture!!!
liq [111]
When a problem comes along, you must whip it.
4 0
3 years ago
Other questions:
  • Pls help me with 24. Thanks
    6·1 answer
  • 21 marbles out of N are blue; probability of getting a blue one = 30%
    6·1 answer
  • ONE GEOMETRY QUESTION
    8·1 answer
  • Mrs. Singh wrote 4 equations on the board.
    11·1 answer
  • Help, guys I have NO CLUE how to do this
    13·2 answers
  • Ollie says that is 25 is x 1/5 the product is equal to 25 is only correct if not explain why
    9·2 answers
  • Suponga que hay 21 casa en un fraccionamiento y 5 de ellas cuentan con sistema de seguridad. se eligen 5 casa al azar.
    10·1 answer
  • A rectangular room measures 21 feet by 28 feet with a 10-foot-high ceiling. The flooring is being replaced with carpeting that s
    12·1 answer
  • AB formed by (-3, 8) and (3, 2) and CD formed by (7.1) and (5, -1). Are these
    14·1 answer
  • What is the length of the diagonal of a rectangle that is 12 inches long and 6 inches wide?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!