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
Antionie went on vacation to las vegas. his room cost $ 115.62 each night. his flight cost $45.70 and his flight home was $32.49
Zigmanuir [339]
115.62 times 3 equals 346.86
then both flights together would be 45.70 plus 32.49 equals 78.19
15 dollars a day for food times 4 equals 60
if he won 75 and lost 25 that would be like only winning 50
then you add them all up and subtract 50
346.86 + 78.19 + 60 - 50 equals 435.05

so he ended up paying 435.05
5 0
3 years ago
Which choice shows the corresponding sides as equal ratios?
mr_godi [17]
The first one

Because you are dividing the second triangle by the first one
3 0
3 years ago
Please hurry!!!!! Also urgent!!!!
vekshin1

Answer:

x=4

Step-by-step explanation:

20x+5+24x-1=180

44x=176

x=4

7 0
3 years ago
What is the value of x ??
almond37 [142]
In a kite, all of the angles added together equal 360. You already know there are two right angles, and because of this, you would subtract 180 from the 360, leaving you with 180. In order to solve for x, you have to add 18x-2 to 12x+2 and set it equal to 180. Your equation would be 18x - 2 + 12x + 2 = 180. The 2's would cancel out, leaving you with 18x + 12x = 180, 30x = 180, then 6 = x.
5 0
3 years ago
100 points. Math Question
topjm [15]
The answer is -2. Hope this helps
5 0
3 years ago
Read 2 more answers
Other questions:
  • Find the length of KNJ
    11·1 answer
  • Corey drives 50 miles &amp; the road is 200 miles, &amp; he wastes 30 miles per gallon, how many more gallons to get 200 miles ?
    6·1 answer
  • Please help me on this
    13·1 answer
  • Eric bought 300 t-shirts, which were sold in packs of 12. how many packs did eric buy?
    7·1 answer
  • Can someone help me with this
    7·2 answers
  • Dominic collected data on the favorite sports of the students of two grades. The table shows the relative frequencies of rows fo
    9·2 answers
  • What is the rate of return when 35 shares of Stock A, purchased for $20/share, are sold for $815? The commission on the sale is
    12·2 answers
  • HELP PLS MARKING BRAINLEIST
    5·2 answers
  • I NEED TO KNOW WHAT THIS IS PLEASE HELP ASAP
    10·1 answer
  • Help me with this one too Have a good day
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!