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
Find the missing coefficient. -___________ y2 − [-5y − y(-7y − 9)] − [-y (15y + 4)] = 0
Luden [163]
  y = 0 
Hope this helps! (:
7 0
3 years ago
Read 2 more answers
From a standard desk of 52 card, 5 card are draw.What are the odds of each even occurring?
boyakko [2]
I think it would be B. Hope this helps!
3 0
3 years ago
Read 2 more answers
22. The height of a triangle is 4 centimeters less than the base. Write a function that
torisob [31]

The function is y = 1/2 x² - 2 x and the base of the triangle cannot be 3 cm.

let the base of the triangle be x

Height of the triangle = x - 4

Area of triangle = 1/2 × base × height

Area = 1/2 × x × (x-4)

Area = 1/2 (x² - 4x)

Area = 1/2 x² - 2 x

We can also write it as a function:

y = 1/2 x² - 2 x

Domain = (3 , ∞)

Range = [0, ∞)

Since 3 is not included in the domain, base of the triangle cannot be 3 cm.

Therefore, the function is y = 1/2 x² - 2 x and the base of the triangle cannot be 3 cm.

Learn more about function here:

brainly.com/question/2456547

#SPJ9

6 0
1 year ago
Help me please.....,,,,,,,,,,,,
attashe74 [19]

Answer:

It has to be a positive number.

Step-by-step explanation:


7 0
3 years ago
Read 2 more answers
A dermatology patient is treated with ultraviolet light having a wavelength of 375 nm. What is the wavelength expressed in centi
sergeinik [125]
1 nanometer = 1 * 10^9 meters

so 1 nanometer =  1 * 10^7 centimeters

375 nanometers =  3,75 *  10^5 centimeters
4 0
3 years ago
Read 2 more answers
Other questions:
  • A window washer charges $50 for a house call and another $10 per window washed.
    13·2 answers
  • There are two other ways to write this fraction.<br><br> −15/29<br> List them in the space below.
    15·1 answer
  • Gus earned $110 the first week he cut grass in the summer. His last week he earned $350. What was his percent increase in earnin
    13·1 answer
  • What are the zeros of the polynomial function f(x) = x3 − 2x2 − 24x?
    10·1 answer
  • Which equation can be used to find the surface area of the cylinder?
    12·1 answer
  • Answer the following monomial of division (-2x^2y^5)^3 (5x^4)/10x^7y^13
    12·2 answers
  • Help help help!!!!!!
    5·1 answer
  • 2 3/4- (-1/4)<br> Anyone have the answer ty
    9·2 answers
  • Evaluate the following<br> expression:<br> (3 - 2)(1.5 -0.5)
    15·2 answers
  • Solve for 100 points
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!