answer.
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]
2 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]2 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]2 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
Oscar recorded the amount of his monthly electric bill for the first 11 months of the year. An ordered list of the amount in dol
grandymaker [24]

Answer:

b

Step-by-step explanation:

8 0
2 years ago
In a game of cornhole, Sasha tossed a bean bag and it landed at the edge of the hole. The hole can be represented by the equatio
Nitella [24]

In the game of cornhole, when Sasha tossed a bean bag to the edge of the hole, in which the equations of the hole and bean bag's path are x² + y² = 5 and y = 0.5x² + 1.5x - 4, respectively, she could have tossed her bean bag to the points (1, -2) or (2, 1).              

 

To find the points in which she could have tossed her bean bag, we need to intersect the two equations of the function as follows.

<u>The equation for the hole</u>

x^{2} + y^{2} = 5   (1)

<u>The equation for the path of the bean bag</u>

y = 0.5x^{2} + 1.5x - 4    (2)

By entering equation (2) into (1) we have:  

x^{2} + (0.5x^{2} + 1.5x - 4)^{2} = 5

x^{2} + 0.25x^{4} + 1.5x^{3} - 4x^{2} + 2.25x^{2} - 12x + 16 = 5    

0.25x^{4} + 1.5x^{3} - 0.75x^{2} - 12x + 11 = 0

By solving for <em>x</em>, we have:

x₁ = 1

x₂ = 2

Now, for <em>y</em> we have (eq 2):

  • <u>x₁ = 1</u>    

y_{1} = 0.5(1)^{2} + 1.5(1) - 4 = -2

  • <u>x₂ = 2</u>

y_{2} = 0.5(2)^{2} + 1.5(2) - 4 = 1                                              

Therefore, the points are (1, -2) or (2, 1).

To find more about intersections, go here: brainly.com/question/4977725?referrer=searchResults        

I hope it helps you!

8 0
2 years ago
Ms. Lindsey surveyed a random sample of students at her school to determine how they got to school. The results are shown below:
Eva8 [605]
20 I think because 8+12
7 0
2 years ago
Assume that a demand equation is giben by q = 7000-100p. Find the marginal revenue for the given production levels (levels of q)
nata0808 [166]

Answer:

Option B.

Step-by-step explanation:

The demand function is

q=7000-100p

where p is price.

Solve the demand equation for p.

100p=7000-q

p=\dfrac{7000-q}{100}

The revenue function is

R(q)=qp

Substitute the value of p in the above function.

R(q)=q(\dfrac{7000-q}{100})

R(q)=\dfrac{7000q-q^2}{100}

Differentiate with respect to q.

R'(q)=\dfrac{7000-2q}{100}

Equate R'(q)=0,

\dfrac{7000-2q}{100}=0

7000=2q

Divide both sides by 2.

3500=q

Therefore, the correct option is B.

4 0
2 years ago
The table shows Mr. Winkler’s schedule for paying off his credit card balance. A 5-column table with 4 rows. Column 1 is labeled
statuscvo [17]

Answer:

3

Step-by-step explanation:

6 0
2 years ago
Read 2 more answers
Other questions:
  • Which rule should be applied to reflect f(x)=x^3 over the y-axis?
    8·2 answers
  • Ming writes a number pattern on a slip of paper and hands it to his friend Jack. 24 21 23 20 22 19 21 18 Jack writes the next nu
    6·1 answer
  • Box A is 567 inches high, 678 inches wide, and 789 inches long. It has a maximum capacity of 1,200 marbles, Box B has three time
    9·1 answer
  • Which describes the correlation shown in the scatterplot?
    15·2 answers
  • The mean gross annual incomes of certified welders are normally distributed with the mean of $20,000 and a standard deviation of
    7·1 answer
  • If m∠ABC = 45° and m∠ECD = 45°, which statement explains whether the AA similarity postulate can be used to determine whether ΔB
    10·1 answer
  • Ashad is rewriting the expression 28 a + 36 a b as a product. Which statements about the expression are accurate and relevant to
    7·1 answer
  • 2 sandwiches and 3 croissants costs £11.
    8·1 answer
  • the cross sectional area of a cylinder is 614 cm 2 the height is 8cm what is the volume of the cylinder​
    6·1 answer
  • Three boards are placed end to end to make a walkway. The first board is 4 feet 5 inches long, the second board is 6 feet 9 inch
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!