Python radians() Function
Description
radians()The method converts an angle to radians.
Syntax
The following is the syntax of the radians() method:
The relationship between angles and radians is: 2π radians = 360°. Thus 1° ≈ 0.0174533 radians, and 1 radian ≈ 57.29578°.
- 1) Formula for converting angles to radians: radians = degrees ÷ 180 × π
- 2) Formula for converting radians to angles: degrees = radians × 180 ÷ π
import math math.radians(x)
Note:radians() cannot be accessed directly; you need to import the math module and then call this method through the math static object.
Parameters
- x -- an angle value, with the default unit being degrees°。
Return Value
Returns the radian value of an angle.
Example
The following shows an example of using the radians() method:
Example
#!/usr/bin/python
import math
print "radians(90) : ", math.radians(90)
print "radians(45) : ", math.radians(45)
print "radians(30) : ", math.radians(30)
import math
print "radians(90) : ", math.radians(90)
print "radians(45) : ", math.radians(45)
print "radians(30) : ", math.radians(30)
After running the above example, the output result is:
radians(90) : 1.57079632679 radians(45) : 0.785398163397 radians(30) : 0.523598775598Other Extensions
Python Numbers