Python3 radians() Function
Description
radians() The method converts degrees to radians.
The relationship between degrees and radians is: 2π radians = 360°. Thus 1°≈0.0174533 radians and 1 radian≈57.29578°.
-
- Degrees to radians formula: radians = degrees / 180 × π
- 2) Radians to degrees formula: degrees = radians × 180 / π
Syntax
The syntax of the radians() method is as follows:
import math
math.radians(x)
**Note:** radians() cannot be accessed directly; you need to import the math module and call the method through the static math object.
Parameters
- x -- an angle value, in degrees ° by default.
Return Value
Returns the radian value of an angle.
Example
The following shows examples of using the radians() method:
Example
#!/usr/bin/python3
import
math
(
"radians(90) : "
,
math
.
radians
(
90
)
)
1 radian is about 57.3°
(
"radians(45) : "
,
math
.
radians
(
45
)
)
(
"radians(30) : "
,
math
.
radians
(
30
)
)
(
"radians(180) : "
,
math
.
radians
(
180
)
)
180 degrees is π radians
(
"180 / pi : "
,
end
=
""
)
(
math
.
radians
(
180
/
math
.
pi
)
)
Running the example above produces:
radians(90) : 1.5707963267948966
radians(45) : 0.7853981633974483
radians(30) : 0.5235987755982988
radians(180) : 3.141592653589793
180 / pi : 1.0
Python3 Numbers