What is the most efficient way to toggle between 0 and 1?
0
1
The easiest way to toggle between 1 and 0 is to subtract from 1.
def toggle(value): return 1 - value