Can you tell me why my fundamental Python program doesn't run properly. First I have a isprime module:
def isPrime(value):
count = 0
for i in range(1, value + 1):
if value % i == 0:
count += 1
if count == 2:
return True
else:
return False
and I import it to the PrimeFinder.py:
from isPrime import isPrime
lst = []
NumberOfValue = int(input())
for i in range(1, NumberOfValue + 1):
value = int(input())
lst.append(value)
for value in lst:
if isPrime(value) == False:
lst.remove(value)
print(lst)
But when I input: the result also include non-prime numbers, can you explain if I was wrong in somewhere, thanks a lot for you help