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
At this rate, would a person your age (18 years old) have contributed a ton of garbage? On average, how long does it take for ea
Sloan [31]

Answer: Yes. On average, it takes about 455 days for 1 person to throw away 1 ton of garbage, so just over 1 year.

Step-by-step explanation: The average person throws away 4.4 pounds of trash daily. So, the way to figure this out is 2,000 divided by 4.4 to find out the number of days it would take to throw away 2,000 pounds of trash.

6 0
3 years ago
Soap films and bubbles are colorful because the interference conditions depend on the angle of illumination (which we aren't cov
mylen [45]

Answer:

56.39 nm

Step-by-step explanation:

In order to have constructive interference total optical path difference should be an integral number of wavelengths (crest and crest should be interfered). Therefore the constructive interference condition for soap film can be written as,

2t=(m+\frac{1}{2} ).\frac{\lambda}{n}

where λ is the wavelength of light and n is the refractive index of soap film, t is the thickness of the film, and m=0,1,2 ...

Please note that here we include an additional 1/2λ phase shift due to reflection from air-soap interface, because refractive index of latter is higher.

In order to have its longest constructive reflection at the red end (700 nm)

t_1=(m+\frac{1}{2} ).\frac{\lambda}{2.n}\\ \\ t_1=\frac{1}{2} .\frac{700}{(2)*(1.33)}\\ \\ t_1=131.58\ nm

Here we take m=0.

Similarly for the constructive reflection at the blue end (400 nm)

t_2=(m+\frac{1}{2} ).\frac{\lambda}{2.n}\\ \\ t_2=\frac{1}{2} .\frac{400}{(2)*(1.33)}\\ \\ t_2=75.19\ nm

Hence the thickness difference should be

t_1-t_2=131.58-75.19=56.39 \ nm

7 0
3 years ago
Is –5 × –5 positive or negative?
liberstina [14]

Answer:

positive

Step-by-step explanation:

a negative times a negative is always a positive

7 0
3 years ago
Read 2 more answers
Please just help with the first qu ?!!!
choli [55]
The answer is 0.67, simply show your work subtracting then and you get that number, it’s basic subtraction, only you have to count the decimal points to put them in the correct spot
3 0
4 years ago
The average hourly charge of plumbers in the Denver area is $84.00 with a standard deviation of $4.00. Assume that the hourly ch
Simora [160]

Answer:

The probability is 0.31

Step-by-step explanation:

In this question, we are tasked with calculating the probability that a random plumber called at Denver will charge an amount greater than $86 given the mean and the standard deviation.

Firstly, we calculate the standard score of $86 using the mean and the standard deviation.

Mathematically;

z-score = (x-mean)/SD

where x = 86, mean = 84 and SD = 4

z-score = (86-84)/4 = 2/4 = 0.5

Hence, we want to calculate P(z ≥ 0.5)

Using standard table

P( (z ≥ 0.5) = 1 - P(z ≤ 0.5) = 1 - ( 0.19146 + 0.5) = 0.30854

To the nearest hundredth = 0.31

5 0
3 years ago
Other questions:
  • A piece of paper is randomly selected from a stack that contains 15 small, 44 large, and 20 extra large pieces.
    14·1 answer
  • Plzz hellp :( i will mark you the brainlist if some on helps (A rectangular prism has a length of 1 1/4 yards, a width of 2 1/2
    6·1 answer
  • The area of a rectangular wall of a barn is 280280 square feet. its length is 88 feet longer than twice its width. find the leng
    13·1 answer
  • Easy question
    12·2 answers
  • If the graphs of the linear equations in a system are parallel, what does that mean about the possible solution(s) of the system
    13·1 answer
  • Jason paid $15.50 for 3 slices of pizza and 2 burgers. Susan paid $20 for 1 slice of pizza and 4 burgers. Write a system of equa
    12·1 answer
  • Solve this absolute value inequality. <br><br> {14-2x]&lt;8
    12·1 answer
  • Line segment XY was used to draw a copy of ABC.XY is 3.5 centimeters long. What is the length of
    8·2 answers
  • The diameter of a circle is 8 cm. find it's area in terms of pi​
    13·2 answers
  • Multiply (2× +4)(×- 4)
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!