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
Judy pays $29 for 8 gallons of gas and 2 bottles of water. Carmen pays $45 for 12 gallons of gas and 4 bottles of water. How muc
Dmitry [639]
G=gas
w=bottle of water

8g + 2w = 29
12g + 4w = 45
I'm going to use elimination to cancel out the variable w by multiplying the first equation by -2.

-16g - 4w = -58
12g + 4w = 45
-4g = -13
/-4 /-4
g = 3.25

Now plug it into an equation, any equation.
8 (3.25) + 2w = 29
26 +2w=29
w=1.5
Now to check, plug it into both equations if you want.

12 (3.25) + 4 (1.5)=45
39 + 6=45

One bottle of water is $1.50, while one gallon of gas is $3.25.
5 0
3 years ago
If Michael invests $2000 in the bank at a rate of 5.5% for 6 years how much interest will he make?
Natalija [7]

Answer:

intereste = 660

Step-by-step explanation:

interest \:  =  \frac{2000 \times 5.5 \times 6}{100}  \\  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  \: =  \frac{66000}{100}  \\  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  \:  = 660 \\

plz..

mark it as a brilliant answer

8 0
3 years ago
-6p + 43=13 What is p?
son4ous [18]
Subtract 43 from both sides
-6p=-30

Divide both sides by -6
p=5

Final answer: p=5
7 0
3 years ago
The lengths of the sides of a triangle or an extended ratio 7 8 and 9 the perimeter of the triangle is 48 cm what are the length
julsineya [31]

Answer:

14cm, 16 cm, 18 cm

Step-by-step explanation:

Note that

= a:b: c = 7:8:9

We have to find the sum of the proportion

Sum of proportion = 7 + 8 + 9

= 24

Length of side a

7/24 × 48 = 14 cm

Length of side b

8 /24 × 48 = 16cm

Length of side a

9/24 × 48 = 18 cm

What are the lengths of the sides?

The lengths of the sides of the triangle in cm are

14cm, 16 cm, 18 cm

4 0
2 years ago
Help Asap if i can i will give brainliest
Aleonysh [2.5K]

Answer:

10x+2y

8c+2

0

Step-by-step explanation:

6 0
3 years ago
Other questions:
  • Find the general solution to the homogeneous differential equation. d2ydx2−1dydx−30y=0 d2ydx2−1dydx−30y=0 Use c1c1 and c2c2 in y
    13·1 answer
  • In how many ways can you receive four cards of the same face value and one card from the other 48 available cards?
    5·1 answer
  • 182,886 rounded to the nearest tenth
    7·2 answers
  • Shelby made 5quarts of juice. she said that she made 1 1\4of juice.expkain her mistake
    10·1 answer
  • What is the solution of the equation when solved over the complex numbers?
    5·2 answers
  • Want an equation in point slope form of the line through the given point and with the given slope
    5·1 answer
  • Please help me idk this
    11·2 answers
  • Someone please help :')
    13·1 answer
  • How do u find the pints of best fit ?
    11·1 answer
  • Help! solve the following expression when d=6 and e=2
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!