Skip to content

Instantly share code, notes, and snippets.

@jingning42
Created September 24, 2014 13:23
Show Gist options
  • Save jingning42/8379cbb8689e1a0813c0 to your computer and use it in GitHub Desktop.
Save jingning42/8379cbb8689e1a0813c0 to your computer and use it in GitHub Desktop.
Project Euler#1
my_list = []
now_list = range(1,1000)
for i in range(1,1000):
if i%3 == 0:
my_list.append(i)
now_list.remove(i)
for j in now_list:
if j%5 == 0:
my_list.append(j)
print my_list
print sum(my_list)
#answer
print(sum(i for i in range(1000) if i%3 == 0 or i%5 == 0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment