Python3 degrees() function

Python3 数字Python3 Numbers


Description

degrees()Convert radians to degrees.


Syntax

The following is the syntax for the degrees() method:

import math

math.degrees(x)

Note:degrees() cannot be accessed directly. You need to import the math module, and then call the method via the math static object.


Parameters

  • x -- a numerical value.

Return Value

Returns an angle value.


Example

The following example shows the usage of the degrees() method:

#!/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))

After running the above example, the output is:

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 数字Python3 Numbers

Other Extensions