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
Select the correct name for the following line.
Pani-rosa [81]
The correct name for the line shown is the answer choice C.

It can be A because the picture is a line not a ray and it cant be B because the picture shown is not a segment

Hope this helps :)
4 0
3 years ago
Read 2 more answers
Susan’s stylist has done a great job of coloring her hair. She wants to leave a 20 percent tip. If the bill was $150, how much s
irina [24]
0.20(150) = 30....her 20% tip would be 30 bucks
6 0
3 years ago
Read 2 more answers
A small box of cereal contains 10 cups of cereal. A medium box of the same cereal contains 30% more cereal than the small box. H
mario62 [17]

Answer:

13 cups

Step-by-step explanation:

If the small box has 10 cups, then:

<u> (small) </u>     <u> 10 cups </u>   =  <u> 100% </u>

(medium)    x cups     =   130%

Now, cross multiply:

10 (130) = x (100)

1300 = 100x

x = 13

Another way to solve this is by turning 30% into a decimal:

30/100 = 0.3

10 (0.3) = 3

Now you have 30% of the 10 cups, but you need <u>30% more</u><em> </em>than the small box, so:

10 + 3 = 13 cups

6 0
3 years ago
Please help it’s for 50 points
amid [387]

Step-by-step explanation:

3√8 is irrational number, and

2√18 is also irrational number

3√8 + 2√18 =

3×2√2 + 2×3√2 =

6√2 + 6√2 = 12√2

so, 12√2 is irrational number.

the correct answer is

A. the sum of two irrational numbers is irrational.

4 0
3 years ago
Jacob distributed a survey to his fellow students asking them how many hours they spent on the Internet in the past day. He also
Anna35 [415]

The linear equation B. y = -x +7.5 best describes the given model. The mood rating for a student that spent 5.5 hours online would be 2.

Step-by-step explanation:

Step 1; We plot the points that fall on the line and that lie on an exact x or y coordinate. The following 4 points are plotted (0.5, 7), (2, 5.5), (2.5, 5) and (3.5, 4). We substitute the values of x in the given equations to see which best describes the model.

Step 2; When y = x + 7.5, we get the coordinates as (0.5, 8), (2, 9.5), (2.5, 10) and (3.5, 11).

When y = -x + 7.5, the coordinates are (0.5, 7), (2, 5.5), (2.5, 5) and (3.5, 4).

When y = \frac{-1x}{2} + 7.5, the coordinates are (0.5, 7.25), (2, 6.5), (2.5, 6.25) and        (3.5, 5.75).

So equation 2 has the closest values to the actaul graph.

Step 3; By substituting x = 5.5, y = -(5.5) + 7.5 = 7.5 - 5.5 = 2.

8 0
3 years ago
Other questions:
  • Which of the following is the function of FX if F^-1 (x) = ×/8 +3
    11·1 answer
  • What is 3/4 divided by 3/12
    6·1 answer
  • PLZ HELP ASAP ROTATE 2D SHAPES IN 3D
    12·2 answers
  • For what value of x does 3^2x=9^3x-4
    10·1 answer
  • Find volume with full working out pls asap
    7·1 answer
  • How much interest is earned on a principal of $9.02 invested at an interest
    7·1 answer
  • Use trigonometry to solve the triangle shown. Round all side lengths to one decimal place and
    8·1 answer
  • The following scatter plot represents the relationship between a person's weight and the number of calories the person burns in
    10·1 answer
  • I just need the answers please and thank you. ​
    14·1 answer
  • If you can please do it all just tryna go to sleep
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!