the-honk/euler/_pythonarchive/1 - Multiples of 3 or 5.py
2024-10-09 18:02:34 +01:00

16 lines
223 B
Python

below = 1000
multiplesOf = [3,5]
toAdd = []
for i in range(1, below):
for num in multiplesOf:
if i % num == 0:
toAdd.append(i)
toAdd = list(dict.fromkeys(toAdd))
total = 0
for i in toAdd:
total += i
print(total)