I encountered the following:
r = random.randint(1,6)
C = "o "
s = '-----\n|' + C[r<1] + ' ' + C[r<3] + '|\n|' + C[r<5]
print(s + C[r&1] + s[::-1])
When executed in IDLE, this outputs an ASCII die with a random value.
How does it work,and more specifically, what do the compare symbols (< and &) accomplish inside the indices?