Python/Project Euler/Problem 01/sol4.py

31 lines
593 B
Python
Raw Normal View History

2018-01-21 08:27:19 +00:00
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
2018-04-15 21:52:45 +00:00
collection = list(set(xmulti+zmulti))
return (sum(collection))
2018-01-21 08:27:19 +00:00
2018-04-15 21:52:45 +00:00
print (mulitples(1000))