Set Theory · Introduction
Lesson 7
This is how one can solve this problem in Python.
from sympy.ntheory import isprime
a = set(range(1, 1001))
b = set(x for x in range(-20, 20) if 1 <= x ** 2 <= 200)
c = {2, 3, 10}
print(len({x for x in a if isprime(x)}.union(b).difference(c)))