Python math.radians() メソッド

Python math 模块Python math モジュール

Python math.radians(x)このメソッドは、角度 x を度からラジアンに変換します。

math.degrees()このメソッドは、ラジアン値を度に変換します。

Python バージョン:\t2.0

構文

math.radians() メソッドの構文は次のとおりです。

math.radians(x)

パラメータの説明:

  • xx -- 必須、数値。x が数値でない場合は、TypeError を返します。

戻り値

弧度値を表す浮動小数点数を返します。

例

次の例では、さまざまな度数をラジアンに変換した結果を返します:

例

# math モジュールをインポート
import math

# 度をラジアンに変換して出力
print(math.radians(180))
print(math.radians(100.03))
print(math.radians(-20))

出力結果:

3.141592653589793
1.7458528507699278
-0.3490658503988659

Python math 模块Python math モジュール

その他の拡張