Radians () method for converting degrees to radians in Python
This article mainly introduces the radians () method for converting degrees to radians in Python. It is the basic knowledge in Python. For more information, see
The radians () method converts degrees to radians x.
Syntax
The following is the syntax of the radians () method:
?
Note: This function cannot be directly accessed. Therefore, we need to import the math module and then use the static object of math to call this function.
Parameters
X -- this must be a value.
Return Value
This method returns the radians of an angle.
Example
The following example shows how to use the radians () method.
?
1 2 3 4 5 6 7 8 9 |
#! /Usr/bin/python Import math Print "radians (3):", math. radians (3) Print "radians (-3):", math. radians (-3) Print "radians (0):", math. radians (0) Print "radians (math. pi):", math. radians (math. pi) Print "radians (math. pi/2):", math. radians (math. pi/2) Print "radians (math. pi/4):", math. radians (math. pi/4) |
When we run the above program, it will produce the following results:
?
1 2 3 4 5 6 |
Radians (3): 0.0523598775598 Radians (-3):-0.0523598775598. Radians (0): 0.0 Radians (math. pi): 0.0548311355616 Radians (math. pi/2): 0.0274155677808 Radians (math. pi/4): 0.0137077838904 |