def sum_of_multiples(limit, factors):
    return sum(filter(lambda n: n < limit,
                      {f*i for i in range(1, limit) for f in factors}))

def sum_of_multiples(limit, factors):
    return sum({n for f in factors for n in range(f, limit, f)})

Use more optimal method of getting multiples
Use more optimal method of getting multiples

  def sum_of_multiples(limit, factors):
+     return sum({n for f in factors for n in range(f, limit, f)})
-     return sum(filter(lambda n: n < limit,
-                       {f*i for i in range(1, limit) for f in factors}))
  
Use more optimal method of getting multiples
## Code Before:
def sum_of_multiples(limit, factors):
    return sum(filter(lambda n: n < limit,
                      {f*i for i in range(1, limit) for f in factors}))

## Instruction:
Use more optimal method of getting multiples
## Code After:
def sum_of_multiples(limit, factors):
    return sum({n for f in factors for n in range(f, limit, f)})
