TechieInsights said:
in 2.5 and above you can do
if any(i%3 == 0, i%5 == 0)
[nitpick: you need an additional set of brackets inside the call to any]
I love it! A totally unnecessary creation of a tuple and a function call
instead of a straight-forward 'or' expression. Can we make this simple task
even more obfuscated?
not all( (i%3 != 0, i%5 !=0) )
Still not convoluted enough.
all( (sum(int(c) for c in str(i))%3 in (1, 2),
str(i).endswith(chr(53)) - 1,
str(i).endswith(chr(48)) - 1) ) - 1
Hmmm... how can I get rid of that pesky %3?
all( (divmod( sum(int(c) for c in str(i)),
41^42)[1] in (1, 2),
str(i).endswith(chr(53)) - 1,
str(i).endswith(chr(48)) - 1) ) - 1
Okay, that makes my brain hurt. I think it will do.