Python math.degrees() Method

Python math 模块Python math Module

Python math.degrees(x)The method converts the angle x from radians to degrees.

PI (3.14..) radians equals 180 degrees, meaning 1 radian equals 57.2957795 degrees.

math.radians()The method converts degree values to radians.

Python Version: 2.3

Syntax

The syntax of the math.degrees() method is as follows:

math.degrees(x)

Parameter Description:

  • xx -- Required, a number. If x is not a number, returns TypeError.

Return Value

Returns a floating-point number representing the angle.

Example

The following example converts various radians to degrees:

Example

# Import the math package
import math

# Output radians converted to degrees
print (math.degrees(8.90))
print (math.degrees(-20))
print (math.degrees(1))
print (math.degrees(90))

Output result:

509.9324376664327
-1145.9155902616465
57.29577951308232
5156.620156177409

Python math 模块Python math Module

Other Extensions