Python math.radians() Method
Python math.radians(x)The method converts angle x from degrees to radians.
math.degrees()The method converts radians to degrees.
Python Version: 2.0
Syntax
The syntax of the math.radians() method is as follows:
math.radians(x)
Parameter Description:
- xx -- Required, a number. If x is not a number, returns TypeError.
Return Value
Returns a float representing the radian value.
Example
The following example returns different degrees converted to radians:
Example
# Import the math package
import math
# Output degrees converted to radians
print(math.radians(180))
print(math.radians(100.03))
print(math.radians(-20))
import math
# Output degrees converted to radians
print(math.radians(180))
print(math.radians(100.03))
print(math.radians(-20))
Output result:
3.141592653589793 1.7458528507699278 -0.3490658503988659Other Extensions
Python math Module