Multiplies of 3 and 5
First read the problem description.
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]))
233168
Source code of the solution(s):
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]))
233168