Ask Question
29 August, 18:46

Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the statements needed to compute the sum of the first n prime numbers. The sum should be associated with the variable total.

Note: is_prime takes an integer as a parameter and returns True if and only if that integer is prime.

+4
Answers (1)
  1. 29 August, 22:01
    0
    Primes = 0

    total = 0

    val = 1

    def is_prime (n):

    n = abs (n)

    i = 2

    while i < n:

    if n % i = = 0:

    return

    False

    i + = 1

    return True
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the statements needed ...” in 📘 Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers