math.cos()
Returns the cosine of the angle.
Syntax
math.cos(n)
The math.cos()
function returns a numeric value between -1 and 1, which represents the cosine of the value n
.
Example 1
Use math.cos()
to return the cosine of a 90
degree angle:
import mathprint(math.cos(90))# Output: -0.4480736161291702
Example 2
Use math.cos()
to return the cosine of a 180.5
degree angle:
import mathprint(math.cos(180.5))# Output: -0.141105086702016