Which statements are used for error handling in Python?
Choose an answer
Tap an option to check your answer.
Correct answer: try/except.
Why this is the answer
In Python, the try/except block is used for error handling. The code that might raise an exception is placed inside the try block. If an exception occurs within the try block, the execution flow immediately jumps to the except block, which contains the code to handle the specific error. This prevents the program from crashing and allows for graceful error recovery. try/catch is a common error handling construct in languages like Java or JavaScript, but not Python. catch/release and block/rescue are not standard error handling keywords in Python or other widely used programming languages.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed