I started learning python today from the tutorial on the official site.
When reading about filter(function, sequence) i thought of making a function that returns if a number is prime to use it with the filter.
notDividedBy = [2,3,4,5,6,7,8,9]
"""True if num is prime, false otherwise"""
copy = notDividedBy[:]
check = True
if num in copy:
for x in copy:
if num % x == 0:
check = False
One thing off the bat, if you are going to implement prime testing in this fashion, there's no reason to use an auxillary array
def prime(num): """True if num is prime, false otherwise""" check = True #if num in copy: # copy.remove(num) for x in range(2,x-1): if num % x == 0: check = False break return check