re: Project Euler #1 - Multiples of 3 and 5 VIEW POST

VIEW FULL DISCUSSION
 

Python

sum = 0
for i in range(0,1000):
    if i % 3 == 0 or i % 5 == 0:
        sum = sum + i
print(sum)

or Python One-Liner

print(sum(i for i in range(1000) if i % 3 == 0 or i % 5 == 0))
code of conduct - report abuse