Latest web development tutorials

python3度()関数

python3デジタル python3デジタル


説明

度は()ラジアンを度に変換します。


文法

次の構文度()メソッドです。

import math

math.degrees(x)

注:度は()に直接アクセスすることはできません、あなたは数学のモジュールをインポートしてから、数学静的オブジェクトによってメソッドを呼び出す必要があります。


パラメータ

  • X - 値。

戻り値

角度を返します。


以下は、()メソッドを度を使用する例を示します。

#!/usr/bin/python3
import math

print ("degrees(3) : ",  math.degrees(3))
print ("degrees(-3) : ",  math.degrees(-3))
print ("degrees(0) : ",  math.degrees(0))
print ("degrees(math.pi) : ",  math.degrees(math.pi))
print ("degrees(math.pi/2) : ",  math.degrees(math.pi/2))
print ("degrees(math.pi/4) : ",  math.degrees(math.pi/4))

上の例の出力を実行した後です。

degrees(3) :  171.88733853924697
degrees(-3) :  -171.88733853924697
degrees(0) :  0.0
degrees(math.pi) :  180.0
degrees(math.pi/2) :  90.0
degrees(math.pi/4) :  45.0

python3デジタル python3デジタル