In [6]:
threes = set(range(3, 1000, 3))
fives = set(range(5, 1000, 5))
threes_n_fives = threes | fives
sum(threes_n_fives)


Out[6]:
233168

In [ ]: