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
Write nine and eighty-four hundredths in standard form.
Scrat [10]
The answer is: 9.84
4 0
3 years ago
Read 2 more answers
Given triangle, ABC is congruent to triangle EDC find A
arlik [135]

Answer:

m<A = 30 degrees.

Step-by-step explanation:

m < C in triangle ABC = m < C in EDC so

x + 13 + 42 + x + 13 = 180

2x = 180 - 13 - 13 - 42

2x = 112

x = 56.

So m < C = 56+13 = 69.

m < B = m < D = 81

M < A = 180 - 69 - 81

= 180 - 150 = 30.

7 0
2 years ago
Solve for n -3n-5=16
Nezavi [6.7K]

Answer:

n = -7

Step-by-step explanation:

Solve for n:

-3 n - 5 = 16

Hint: | Isolate terms with n to the left-hand side.

Add 5 to both sides:

(5 - 5) - 3 n = 5 + 16

Hint: | Look for the difference of two identical terms.

5 - 5 = 0:

-3 n = 16 + 5

Hint: | Evaluate 16 + 5.

16 + 5 = 21:

-3 n = 21

Hint: | Divide both sides by a constant to simplify the equation.

Divide both sides of -3 n = 21 by -3:

(-3 n)/(-3) = 21/(-3)

Hint: | Any nonzero number divided by itself is one.

(-3)/(-3) = 1:

n = 21/(-3)

Hint: | Reduce 21/(-3) to lowest terms. Start by finding the GCD of 21 and -3.

The gcd of 21 and -3 is 3, so 21/(-3) = (3×7)/(3 (-1)) = 3/3×7/(-1) = 7/(-1):

n = 7/(-1)

Hint: | Simplify the sign of 7/(-1).

Multiply numerator and denominator of 7/(-1) by -1:

Answer: n = -7

7 0
3 years ago
Read 2 more answers
What is the difference between centroid orthocentre and circumcentre​
Sergeu [11.5K]

Answer:

centroid- the point of concurrency of the <em>medians.</em>

<em />

orthocenter- the point of concurrency of the <em>altitudes.</em>

<em />

circumcenter- the point of concurrency of the <em>perpendicular bisectors.</em>

<em />

hope this helps :)

3 0
3 years ago
1 and 2 is all I need and you guys would help me from not getting beat
Sonja [21]

Answer:

1. -10

2. -11

Step-by-step explanation:

6 0
3 years ago
Other questions:
  • a ski cabi can safely carry x number of people there are already 2/3x people in the cabin when another 15 are allowed to board i
    5·1 answer
  • If m HELP ASAP PLEASE
    12·1 answer
  • Six times the difference of 2a and B increased by 4B
    10·2 answers
  • Quadrilateral ABCD is an isosceles trapezoid. If AB || CD, AB = m + 6, CD = 3m + 2, BC = 3m, and AD = 7m - 16, solve for m.
    11·2 answers
  • NEED TO KNOW IMMEDIATELY the Revenue each season from tickets at the theme part is represented by t(x) = 3x the cost to pay the
    6·1 answer
  • Identify the percent of change as an increase or a decrease 3/8 to 7/8
    10·1 answer
  • What is the range of f(x) = 3X + 9?<br> {yly&lt;9}<br> {yly&gt;9}<br> {yly&gt; 3}<br> {yly&lt;3}
    8·1 answer
  • Katya decided that she could not afford the $48,000 it would cost her to attend college and get her four-year degree. Instead, s
    15·1 answer
  • I NEED HELP PLEASEEE
    10·2 answers
  • Kay's mother taught her how to make handmade ornaments to sell at a craft fair. Kay rented a table at
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!