This is what I have:
list1 = range(2, 11)
list2 = range(2, 11)
primes = []
primes.append(?)
? % ? == 0....
primes = set(primes)
Using comprehensions, how can I have list1
be iterated 2-10, and divided by an iterated list2
and have the results with no zero remainder appended to primes? I can then turn the list into a set to remove duplicates. I see that a function is possible as well, I just can't get my brain around to how to write it?
The desired result is. primes = [2, 3, 5, 7]