Pythonプログラミング言語において、“NameError: name ‘math’ is not defined”エラーが起こる場合があります。エラーの対処方法と解決方法について紹介します。
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> math.pi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'math' is not defined
解決
モジュールをインポートしなければいけない
from math import *
