Can someone please explain why the output is A for following code.
a = True
print (('A','B')[a == False])
Can someone please explain why the output is A for following code.
a = True
print (('A','B')[a == False])
Assuming first line is a = True, a == False evaluates to false, therefore boolean value of 0. Therefore your expression is same as print(('A', 'B')[0]) which prints 'A'