What is math.degrees() in Python?

The degrees() function in Python converts the radian value to degrees.

Figure 1 shows a mathematical representation of the degrees() function.

Figure 1: Mathematical representation of degrees() function

The math module is required for this function.

Syntax

degrees(value)

Parameter

The degrees() function takes a numberradian value as a parameter.

Return value

The degrees() function then converts the radian value sent as a parameter to degrees.

Code

import math
#pi
print "The value of degrees(PI) : ", math.degrees(math.pi), "Degrees"
#0
print "The value of degrees(0) : ", math.degrees(0), "Degrees"
#-pi
print "The value of degrees(-PI) : ", math.degrees(-math.pi), "Degrees"

Free Resources