#!/usr/bin/env python # coding: utf-8 # In[8]: def divisible_by(n, ds): return any(n % d == 0 for d in ds) sum(n for n in range(1000) if divisible_by(n, [3,5]))