I have the following code which works
[i for i in range(1, 16) if any(i % j == 0 for j in [3,5])]
This has an output of [3, 5, 6, 9, 10, 12, 15], the numbers that can be divided by either 3 or 5.
However, when I try
[i for i in range(1, 16) if any(i % j != 0 for j in [3,5])]
I get [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
What I'm looking for instead is [1, 2, 4, 7, 8, 11, 13, 14]
Many thanks!