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
Which of the following is most likely the next step in the series?<br>​
Andrej [43]

Answer:

B

Step-by-step explanation:

They are increasing by 1 vertically. Hope this helps!! :)

5 0
2 years ago
Read 2 more answers
Find the amount of 30000 naira 5 and half years at 7%​
Nataly_w [17]

Answer:41550

Step-by-step explanation:

30000×.07=2100

2100×5.5=11550

11550+30000=41550

5 0
3 years ago
Composite functions question : what's the value?
tester [92]

(f\circ f)(x)=f(f(x))\\\\ (f\circ f)(x)=x^2\Longleftrightarrow f(f(x))=x^2\\\\ f(f(f(f(f(f(2))))))=f(f(f(f(4))))=f(f(16))=256

7 0
3 years ago
Find the missing length in the image below
crimeas [40]

Answer:

not similar

Step-by-step explanation:

32/26 = 16/13

18/12 = 3/2

16/13 is not equal to 3/2, so the rectangles are not similar.

7 0
2 years ago
Read 2 more answers
I need help! ASAP PLS
Delicious77 [7]

Answer:

The area is 155 ft.

Step-by-step explanation:

To find the area if a trapezoid, you have to add the number on top( in this case 13 ft) and then add that with the bottom number(18 ft.) Then, you take that answer and divide it by 2. After that, multiply it with the height(10.) Thus, the answer is 155 ft.

3 0
2 years ago
Other questions:
  • Why should "for deposit only" be written on a check along with the bank account number when it is endorsed?
    13·2 answers
  • (REPEATING DECIMALS) do part A and B please
    13·1 answer
  • 5. trey made pasta in the Shape of a square ; He draws 2 lines to cut the pasta into smaller pieces The smaller pieces have L I
    14·2 answers
  • 26 was divided by a power of ten to get 0.26. What power of ten was it divided by?
    13·1 answer
  • In 4 years, a mother will be 5 times as old as her daughter. At present, the mother is 9 times as old as the daughter. How old a
    13·2 answers
  • Please help!, thanks. please no scam answers​
    5·1 answer
  • a box has a length of 6x inches the width equals one third the length and the height equals half the length. if the volume equal
    15·2 answers
  • Qu.com/game/U2FdGVkXWONIO MOLISKONDOOMOOON704022 KOVO2.820073022000267grype
    10·1 answer
  • alex and chris share sweets in the ratio. alex : chris = 7:3. alex recieves 20 more sweets more than chris. work out the number
    12·1 answer
  • Does anyone else like Gavin Magnus? If so what are your favorte things about him! I'mgiving brainliest
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!