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
Edit this page on GitHub

Contributors

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

Learn Python on Codecademy

Edit this page on GitHub

Contributors