Q18Software Development and Design
Refer to the exhibit. A developer created this code, but it does not execute. Which code snippet helps identify the issue?
← → navigate · a answer
Discussion · 8
22
The catch statement is incorrect. The right answer is A.
8
Answer is ‘A’.
There is no ‘catch’ statement in the Python language.
4
A is less wrong than the rest :)
3
I'll go with A too.
The try block lets you check a block of code for errors.
The except block lets you deal with the error.
The finally block lets you run code, no matter the result of the try- and except blocks.
try:
print(x)
except:
print("An exception occurred")
2
A is correct.. there is no catch in python.
try:
# do something
pass
except ValueError:
# handle ValueError exception
pass
1
Agree with A
>>> read_file = open("me.txt", "r")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'me.txt'
>>>
1
A is correct
the catch is not a statement in python
1
Correct answer: A
>>> read_file = open("me.txt", "r")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'me.txt'