Python math.radians() Method
Python math.radians(x) The method converts an angle x from degrees to radians.
math.degrees() The method converts a radian value to degrees.
Python version: 2.0
Syntax
The syntax of the math.radians() method is as follows:
math.radians(x)
Parameter Description:
- x -- required, a number. If x is not a number, a TypeError is returned.
Return Value
Returns a floating-point number representing a radian value.
Example
The following example converts different degree values to radians:
Example
Import the math package
import
math
Output the degree-to-radian conversions
(
math
.
radians
(
180
)
)
(
math
.
radians
(
100.03
)
)
(
math
.
radians
(
20
)
)
Output result:
3.141592653589793
1.7458528507699278
-0.3490658503988659
Python math Module