the-honk/euler/_pythonarchive/1 - Multiples of 3 or 5.py

17 lines
223 B
Python
Raw Normal View History

2024-10-09 17:02:34 +00:00
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)