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 math
print(math.cos(90))
# Output: -0.4480736161291702

Example 2

Use math.cos() to return the cosine of a 180.5 degree angle:

import math
print(math.cos(180.5))
# Output: -0.141105086702016

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn Python on Codecademy