Ask Question
21 July, 23:38

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 if m divides n evenly.)

+3
Answers (1)
  1. 22 July, 00:07
    0
    This is the following condition in order to get the specific output for this specific problem: if is_a_prime (n) : is_prime = True Now all you have to do is write is_a_prime ().

    For the hard code for this problem:

    if n = = 2:

    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

    break.

    To add, a high-level programming language that is widely used for general-purpose programming, created by Guido van Rossum and first released in 1991 is called Python.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “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 if m divides ...” in 📗 Mathematics if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers