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

17 lines
223 B
Python
Raw Permalink Normal View History

2021-10-29 00:00:43 +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)