Question #214

What is the output of the code snippet below?
a = True
print(('A', 'B')[a == False])

Here ('A', 'B') is a tuple. The a == False is an expression that is evaluated as boolean. In Python 3 True and False are keywords and will always be equal to either 1 or 0. So the result will be A. (

Comment on Disqus:

Comment on Twitter:

Question difficulty: πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅

Similar questions: