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

Solution: Import the 'pi' module

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

from math import pi

 

For more information:
Python math pi