Ad

find_multiples = lambda n :sum(i for i in range(n) if ((i%4 == 0) or (i%6 == 0)))

Code
Diff
  • find_multiples = lambda n :sum(i for i in range(n) if ((i%4 == 0) or (i%6 == 0)))
    • def find_multiples(n):
    • return sum({*range(4, n, 4), *range(6, n, 6)})
    • find_multiples = lambda n :sum(i for i in range(n) if ((i%4 == 0) or (i%6 == 0)))