निम्नलिखित कोड खंड क्या प्रिंट करेगा?
What will following code segment print ?
if True or True:
if False and True or False:
print(‘A’)
elif False and False or True and True:
print(‘B’)
else:
print(‘C’)
else:
print(‘D’)
A)
B)
C)
D)
Explanation:
Sure!
True or True
isTrue
, so the first block is executed.- The second condition
False and True or False
isFalse
, so it moves toelif
. False and False or True and True
isTrue
, so it prints'B'
.
Answer: (B) B.