mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-27 02:12:31 +08:00
increment 1
This commit is contained in:
30
project_euler/Problem 01/sol4.py
Normal file
30
project_euler/Problem 01/sol4.py
Normal file
@ -0,0 +1,30 @@
|
||||
def mulitples(limit):
|
||||
xmulti = []
|
||||
zmulti = []
|
||||
z = 3
|
||||
x = 5
|
||||
temp = 1
|
||||
while True:
|
||||
result = z * temp
|
||||
if (result < limit):
|
||||
zmulti.append(result)
|
||||
temp += 1
|
||||
else:
|
||||
temp = 1
|
||||
break
|
||||
while True:
|
||||
result = x * temp
|
||||
if (result < limit):
|
||||
xmulti.append(result)
|
||||
temp += 1
|
||||
else:
|
||||
break
|
||||
collection = list(set(xmulti+zmulti))
|
||||
return (sum(collection))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print (mulitples(1000))
|
Reference in New Issue
Block a user