Python math.pi 定数
Python math.pi浮動小数点数値 π を返します。一般に円周率を指し、円周率 PI (3.1415...) のことです。
PI: 3.141592653589793。
構文
math.pi 定数の構文は次のとおりです:
math.pi
戻り値
浮動小数点数 3.141592653589793 を返します。円周率を表します。
例
次の例では PI を返します:
例
# math パッケージをインポート
import math
# PI を出力
print (math.pi)
import math
# PI を出力
print (math.pi)
出力結果:
3.141592653589793その他の拡張
Python math モジュール