Python math.cos() Method
Python math.cos(x) Returns the cosine of x radians.
Python version: 1.4
Syntax
The syntax of the math.cos() method is as follows:
math.cos(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 the cosine of x, between -1 and 1.
Example
The following example returns the cosine of numbers:
Example
Import the math package
import
math
Output the cosine values
(
math
.
cos
(
0.00
)
)
(
math
.
cos
(
1.23
)
)
(
math
.
cos
(
10
)
)
(
math
.
cos
(
3.14159265359
)
)
Output result:
1.0
0.3342377271245026
-0.8390715290764524
-1.0
Python math Module