当前位置:首页 > python教程 > python进阶

Python math.degrees() 方法

python math.degrees() 方法

python math.degrees(x) 方法将角度 x 从弧度转换为度数。

pi (3.14..) 弧度等于 180 度,也就是说 1 弧度等于 57.2957795 度。

math.radians() 方法将度数值转换为弧度。

python 版本: 2.3

语法

math.degrees() 方法语法如下:

math.degrees(x)

参数说明:

  • x -- 必需,数字。如果 x 不是一个数字,返回 typeerror。
返回值

返回一个浮点数,表示角度。

实例

以下实例返回不同弧度转换为度数:

实例

# 导入 math 包
import math

# 输出弧度转换为度数
print (math.degrees(8.90))
print (math.degrees(-20))
print (math.degrees(1))
print (math.degrees(90))

输出结果:

509.9324376664327
-1145.9155902616465
57.29577951308232
5156.620156177409


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐