Skip to main contentSkip to solution

Which of the following exception is raised when the requested module definition is not found?

Solution

✅ Correct Option: 1

ImportError is raised when an import statement cannot find the module definition it was asked to load. It is also raised when from module import name cannot find that name in the module.

In Python 3.6 and later, a missing module raises ModuleNotFoundError, which is a subclass of ImportError.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question