QUESTION IMAGE
Question
question 3
what will the following code print?
try:
5/0
except zerodivisionerror:
print(\cannot divide by zero!\)
print(\program is still running\)
0
zerodivisionerror: division by zero
program is still running.
cannot divide by zero! program is still running.
Step1: Analyze the code
The code tries to perform 5/0 which raises a ZeroDivisionError. The except block catches this error and prints "Cannot divide by zero!".
Step2: Check the remaining code
After the except block, the code print("Program is still running") is outside the except block but in the same indentation level as the except block. So it will execute.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
Cannot divide by zero! Program is still running.