What will be the output of the following statement in Python? print(True or…
2026
What will be the output of the following statement in Python?
print(True or False and False or not False)
- A.
None
- B.
False
- C.
True
- D.
Error
Attempted by 219 students.
Show answer & explanation
Correct answer: C
In Python, operator precedence determines the order of evaluation. The 'not' operator has the highest precedence, followed by 'and', then 'or'. First, evaluate 'not False' to get True. The expression becomes: True or False and False or True. Next, evaluate 'and': 'False and False' results in False. Now we have: True or False or True. Finally, evaluate 'or' from left to right: 'True or False' is True, and 'True or True' remains True. The final output is True.