I just did this how’s your day going a[idx % len(a)] * (idx < len(a))
-
-
I am apparently a stupid people - is this going to return 0 for the head & tail of a list, but non-zero for everything else?
-
It’s going to return the appropriate element of a list without requiring an explicit bounds check (because we don’t care about the output when the index would be out of bounds)
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.