- Python 3 教程
- Python3 基本数据类型
- Python3 解释器
- Python3 注释
- Python3 运算符
- Python3 数字(Number)
- Python3 字符串
- Python3 列表
- Python3 元组
- Python3 字典
- Python3 编程第一步
- Python3 条件控制
- Python3 循环语句
- Python3 迭代器与生成器
- Python3 函数
- Python3 数据结构
- Python3 模块
- Python3 输入和输出
- Python3 File(文件) 方法
- Python3 OS 文件/目录方法
- Python3 错误和异常
- Python3 面向对象
- Python3 标准库概览
- Python3 实例
- Python3 正则表达式
- Python CGI编程
- Python3 MySQL 数据库连接
- Python3 网络编程
- Python3 SMTP发送邮件
- Python3 多线程
- Python3 XML解析
- Python3 JSON 数据解析
- Python3 日期和时间
- Python3 range() 函数用法
- Python3 内置函数
Python3 degrees() 函数
描述
degrees() 将弧度转换为角度。
语法
以下是 degrees() 方法的语法:
import math math.degrees(x)
注意:degrees()是不能直接访问的,需要导入 math 模块,然后通过 math 静态对象调用该方法。
参数
- x -- 一个数值。
返回值
返回一个角度值。
实例
以下展示了使用 degrees() 方法的实例:
#!/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 tan() 函数
关注微信小程序
扫描二维码
程序员编程王