Python math.degrees() 方法

math.degrees()方法是数学模块的一种库方法,用于将角度值从弧度转换为度,它接受一个数字并返回以度为单位的角度值。

注意: math.degrees()方法仅接受数字,如果我们提供除数字以外的其他任何内容,它将返回错误TypeError – “ TypeError:需要浮点数”。

它的语法 math.degrees() 方法:

math.degrees(x)

Parameter(s): x –是要转换为度的弧度数。

返回值: float-它返回一个浮点值,即以度为单位的角度值。

示例

Input:

x = 10.25

# 函数调用

print(math.degrees(x))

Output:

587.2817400090938

Python代码演示示例 math.degrees() 方法

# Python代码演示示例

# math.degrees() method

# 导入数学模块

import math

# 弧度数

x = 0

print("math.degrees(",x,"): ", math.degrees(x))

x = 0.25

print("math.degrees(",x,"): ", math.degrees(x))

x = 10.25

print("math.degrees(",x,"): ", math.degrees(x))

x = -0.25

print("math.degrees(",x,"): ", math.degrees(x))

输出结果

math.degrees( 0 ):  0.0

math.degrees( 0.25 ):  14.32394487827058

math.degrees( 10.25 ):  587.2817400090938

math.degrees( -0.25 ):  -14.32394487827058

TypeError示例

# Python代码演示示例

# math.degrees() method with exception

# 导入数学模块

import math

# 弧度数

x = "10"

print("math.degrees(",x,"): ", math.degrees(x))

输出结果

Traceback (most recent call last):

File "/home/main.py", line 9, in

print("math.degrees(",x,"): ", math.degrees(x))

TypeError: a float is required

math求旋转角度 python_带有Python示例的math.degrees()方法相关推荐

  1. tanh python_带有Python示例的math.tanh()方法

    tanh python Python math.tanh()方法 (Python math.tanh() method) math.tanh() method is a library method ...

  2. math.trunc_带有Python示例的math.trunc()方法

    math.trunc Python math.trunc()方法 (Python math.trunc() method) math.trunc() method is a library metho ...

  3. np.isfinite_带有Python示例的math.isfinite()方法

    np.isfinite Python math.isfinite()方法 (Python math.isfinite() method) math.isfinite() method is a lib ...

  4. factorial函数_带有Python示例的math.factorial()方法

    factorial函数 Python math.factorial()方法 (Python math.factorial() method) math.factorial() method is a ...

  5. np.copysign_带有Python示例的math.copysign()方法

    np.copysign Python math.copysign()方法 (Python math.copysign() method) math.copysign() method is a lib ...

  6. 带有Python示例的math.sin()方法

    Python math.sin()方法 (Python math.sin() method) math.sin() method is a library method of math module, ...

  7. tf.acos_带有Python示例的math.acos()方法

    tf.acos Python math.acos()方法 (Python math.acos() method) math.acos() method is a library method of m ...

  8. math.atan2_带有Python示例的math.atan2()方法

    math.atan2 Python math.atan2()方法 (Python math.atan2() method) math.atan2() method is a library metho ...

  9. css degrees_带有Python示例的math.degrees()方法

    css degrees Python math.degrees()方法 (Python math.degrees() method) math.degrees() method is a librar ...

最新文章

  1. 独家 | 利用Auto ARIMA构建高性能时间序列模型(附Python和R代码)
  2. Eclipse编译时保留方法的形参
  3. [Node.js] 模块化 -- url、querystring模块
  4. 业界分享 | 阿里达摩院:超大规模预训练语言模型落地实践
  5. windows netstat taskkill命令 操作进程
  6. Linux系统中安装软件的三种方法
  7. 学习笔记12-SG90舵机
  8. C语言经典笔试题解析,原来微软笔试题也有简单的,C语言学习专题
  9. Servlet中request.getParameter和getParameterValues getParameterNames三者区别
  10. 大型网站技术架构核心原理与案例分析(李智慧)学习笔记2--大型网站架构五大核心要素
  11. python实战(一)Python爬取猫眼评分排行前100电影及简单数据分析可视化
  12. 我读《格鲁夫给经理人的第一课》
  13. 2048游戏制作html,一个自制的2048小游戏(一)
  14. ORA-12560:TNS:协议适配器错误的解决方案
  15. Elasticserch 5.6到Elasticsearch7.11跨版本升级踩坑记录
  16. Spark学习痛点和路线图
  17. 機器學習基石 机器学习基石 (Machine Learning Foundations) 作业二 Q19-20 C++实现
  18. Amlogic S905Y4 机顶盒KM7
  19. 原声js 的兼容(屏幕尺寸、事件处理程序、阻止事件冒泡、事件目标等等)
  20. 免费的档案管理系统介绍

热门文章

  1. windows认证之域认证:Kerberos协议认证
  2. 门户级UGC系统的技术进化路线——新浪新闻评论系统的架构演进和经验总结
  3. 《天才在左疯子在右》
  4. MySQL数据一致性检查的几个工具
  5. Oracle中rank() over()函数排名
  6. IT项目管理六|项目时间管理
  7. centos修改磁盘uuid_磁盘UUID以及卷标
  8. CentOS宝塔搭建(超详细)
  9. 博弈论学习笔记(七)纳什均衡伯川德模型与选民投票
  10. 因果图,鱼骨图,石川图