_______ statement in python is used to test an expression in the program code.
_______ statement in python is used to test an expression in the program code.
Solution
✅ Correct Option: 2
The assert statement tests an expression (a condition) in the code. If the expression is True, the program continues. If it is False, Python raises an AssertionError, optionally with a message, as in assert x > 0, "x must be positive".
Try: marks a block of code in which exceptions are to be handled, and does not test a condition.
Finally: a block that runs whether or not an exception occurred, usually for cleanup.
Catch: not a Python keyword. Python uses except, while catch belongs to Java and C++.
Related questions:
2026: 29 May Shift 1
2026: 20 May Shift 1