Question: The following function is meant to determine if a given integer is prime ( meaning it is only evenly divisible by 1 and itself )
The following function is meant to determine if a given integer is prime meaning it is only evenly divisible by and itself For instance, is prime should return True, while is prime should return
False because is divisible by and The code does this by creating a list of the prime numbers upto and including the inputed integer and then checking if the inputed integer is in that list.
The code has errors. Your job is to tell me the line number of each of the errors. Note: there can be multiple errors on the same line. If the line has more than error, you should communicate that
information to me list the line times if the same error appears there times or you can say line has errors You can tell me what the error is or how to fix it or something else. If you do give me a
reason for the error, then yeu can earn full credit even if we disagree on the line number my numbers are all where the code has a problem, not necessarily where the interpreter will fire the exception
However, if you do give me a reason, then I will count off points if your reasoning is wrong even if you tell me the correct line
The code is as follows:
def isprimex:
primes
for y in range x:
primeflag False
for prime in primes:
if y prime :
primeflag False
if primeflag:
primes y
return primes
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
