Before I ask the question, this is what I have, I think it\'s near but no cigar
ID: 3644675 • Letter: B
Question
Before I ask the question, this is what I have, I think it's near but no cigar yet.
total = 0
for iterator in xrange(0, n):
....if (is_prime(iterator) == True):
........total += iterator
but i know the iterator should be gone.
If we assume the availbity of a function the_prime. Also assume a variable w is associated with a positive integer. I need to write the statements needed to compute the sum of the first w prime numbers. The sum should be associated with the variable total.
Also, the_prime takes an int as a parameter and it will return True only if the integer is prime.
Explanation / Answer
def the_prime(w): total = 0 flag = 0 count = 0 a=1 while (countRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.