How to Solve NameError: name 'exit' is not defined -- sys

Solution: Import the 'exit' module

To Solve the error, add the following line to the top of your code.

from sys import exit

 

For more information:
Python sys exit