Symbol(clack:cancel)
This commit is contained in:
26
solutions/0000_0029/0001.multiples/euler_1.py
Normal file
26
solutions/0000_0029/0001.multiples/euler_1.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
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()
|
||||
Reference in New Issue
Block a user