Ad

No need for brackets as we're not building a list, a for comprehension is enough.

Code
Diff
  • def mul():
        return sum(i for i in range(1000) if i % 3 == 0 or i % 5 == 0)
        
    • def mul():
    • return sum([i for i in range(1000) if i%3 == 0 or i%5 == 0])
    • return sum(i for i in range(1000) if i % 3 == 0 or i % 5 == 0)