I wrote Project Euler problem 1 in one liner.
Proposal 1 print sum([i for i in range(1,1000) if i%3*i%5==0])
print sum([i for i in range(1,1000) if i%3*i%5==0])
Answer plan 2 print sum(set(range(3,1000,3)+range(5,1000,5)))
print sum(set(range(3,1000,3)+range(5,1000,5)))
That's all I came up with for the time being.
Recommended Posts