I've came across bitwise operators, and they really seem odd to me. Just wanted to get clarifications on two questions that I don't fully understand. The first piece of code is:
x = raw_input('Enter a digit: ')
print 'x is %s' % ('Even', 'Odd')[x & 1]
The question is the following - How does it exactly evaluates to 'Even' if I enter an even digit, and how does it pick the first element in parenthesis after evaluation?
On top of the that, can you please explain this piece of code:
if a[i-1] & 1 and a[i] & 1:
do some stuff
Thank you all