What is math.radians() in Python?

The radians() function in Python converts a value in degrees to the equal value in radians.

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

Figure 1: Mathematical representation of radians() function

The math module is required for this function.

Syntax

radians(value)

Parameter

The radians() function takes a numberdegree value as a parameter.

Return value

The radians() function converts the value in degrees sent as a parameter to a value in radians.

Code

import math
#pi
print "The value of radians(180) : ", math.radians(180), "Radians"
#0
print "The value of radians(0) : ", math.radians(0), "Radians"
#-pi
print "The value of radians(-180) : ", math.radians(-180), "Radians"

Free Resources