Advertisements
Advertisements
Question
When are the following built-in exceptions raised? Give examples to support your answer.
NameError
Short/Brief Note
Advertisements
Solution
It is raised when a local or global variable name is not defined.
>>> print(name)
Traceback (most recent call last):
File "", line 1, in
print(name)
NameError: name 'name' is not definedshaalaa.com
Built-in Exceptions in Python
Is there an error in this question or solution?
