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"
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources