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
The sets A,B and C in a universal set consisting of the first 10 lower case letters of the alphabet are: A={a,b,c}, B={b,c,a,e},
Papessa [141]

Answer:

Which item fits in the left side of the table?Criminal versus Civil Cases Criminal cases Civil cases ? . • Accuser is called the plaintiff • Lower burden of proof Defendant may be found liable • Usually heard by a judge only • Accused not guaranteed an attorney

A. No burden of proof

B. Accuser is called the defendant

C. Defendant may be found guilty

D. Usually heard by a jury only

8 0
3 years ago
A data scientist studying a manufacturing process classifies each item produced by the process as either Poor, Acceptable, or Ex
Genrish500 [490]

Answer:

0.214 ; 0.064 ; 0.3859 ; 0.9966 ; 0.135

Step-by-step explanation:

Given the distribution :

Poor ___ Acceptable ____ Excellent

0.25 _____ 0.6 _________ 0.15

The data scientist receives three items produced by the manufacturing process.

Find the chance that:

a. all of items are Acceptable

0.6 * 0.6 * 0.6 = 0.6^3 = 0.214

b. none of the items is Acceptable

P(not acceptable) = 1 - p(acceptable) = 1 - 0.6 = 0.4

0.4 * 0.4 * 0.4 = 0.4^3 = 0.064

c. at least one of the items is Excellent

P(atleast one) = 1 - P(none)

P(not excellent) = 1 - 0.15 = 0.85

P(none is excellent) = 0.85^3 = 0.614125

Hence,

P(atleast one is excellent) = 1 - 0.614125 = 0.3859

d. not all of the items are Excellent

P(not all) = 1 - p(All)

P(all excellent) = 0.15^3 = 0.003375

P(not all are excellent) = 1 - 0.003375 = 0.9966

e. there is one item of each class:

P(poor) * p(acceptable) * p(excellent) * (number of classes)!

0.25 * 0.6 * 0.15 * 3!

= 0.135

3 0
3 years ago
Can sumone answer this &gt;:D ???????/
nirvana33 [79]

Answer:

3x + 4y - 32= 0

Step-by-step explanation:

.....

.......

8 0
3 years ago
Read 2 more answers
What is the vertex and the equation of the axis of symmetry of the graph of y=x2-6x-7?
Ray Of Light [21]
X= -b over 2a = --6 over 2×1=3
y=3²-6(3)-7=-16
vertex is (3,-16)
axis of symmetry is 3
3 0
3 years ago
Read 2 more answers
Help me please, i need to turn this in quick and im struggling.
erik [133]

Answer:

3) 0.75

5)96 pens

Step-by-step explanation:

3) 5 percent *15 =

( 5:100)*15 =

( 5*15):100 =

75:100 = 0.75

5) 48/4= 12

12*8=96

8 0
3 years ago
Other questions:
  • A carrot has 55 grams of sugar per serving. A banana has 1515 grams of sugar per serving. Which statement is true?
    7·1 answer
  • Describe a process you would use to create the perpendicular bisector to a segment AB using only an unmarked straightedge and an
    12·1 answer
  • Mrs. Hall records the height of 50 students in a spreadsheet the mean height is 68 inches after looking at the data again she re
    15·2 answers
  • At a rate of 4.25% over 24 months. If he pays $51.00 in interest, what was the original amount of his loan?
    11·1 answer
  • Sum of the numbers m and n decreased by their product; write the algebraic expression​
    11·1 answer
  • Please help!!!! No explanation needed <br> Help is appreciated
    8·1 answer
  • Solve please 14a⁹b-8a³d÷ 2a³​
    15·1 answer
  • PLEASE HELP ASAP!!!!
    11·1 answer
  • Please please tell the truth I love the answers please tell them to me
    9·1 answer
  • Need help with this question asap please please
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!