How to Solve NameError: name 'sqrt' is not defined -- math

Solution: Import the 'sqrt' module

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

from math import sqrt

 

For more information:
Python math sqrt