Files
SolutionEuler/solutions/0001.multiples/euler_1.py

27 lines
436 B
Python

"""
Project Euler Problem 1 :
Find the sum of all the multiples of 3 or 5 below 1000.
"""
UP_NUM = 1000
def condition(num: int) -> bool:
if num % 3 == 0:
return True
elif num % 5 == 0:
return True
return False
def main():
res = []
for i in range(1, UP_NUM):
if condition(i):
res.append(i)
print(sum(res))
if __name__ == "__main__":
main()