Pythonのモジュールをインポートして使う
Pythonでは、モジュールという仕組みにより機能拡張をすることができる。
数学モジュール(mathモジュール)をインポートする
>>> import math
円周率 πが使用できるようになる
>>> print math.pi
3.14159265359
例えば半径を5.0にして、
>>> r = 5.0
円周を計算
>>> print 2*r*math.pi
31.4159265359
円の面積を計算
>>> print r*r*math.pi
78.5398163397
球の体積を計算
>>> print (4/3)*r*r*r*math.pi
392.699081699
#Python-tutorial
https://img.shields.io/badge/python-Pythonのモジュールをインポートして使う-3776AB.svg?style=for-the-badge&logo=python&logoColor=EECC00