What is the output of the following Python code snippet?
try:
assert 1 == 2
except AssertionError:
print('AssertionError')
-
A
AssertionError
Correct answer
-
B
None
-
C
True
-
D
0
Correct answer
A. AssertionError
5 views
Explanation
assert raises AssertionError when the condition is false.
Doubts & discussion
Not sure why the answer is A? Ask here and get an explanation.
Ask a doubt about this MCQ