Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python math.cos() function returns trigonometric cosine of an angle (angle should be in radians).

Syntax

math.cos(x)

Parameters

x Required. Specify the angle in radian.

Return Value

Returns the trigonometric cosine of an angle.

Example:

In the below example, cos() function is used to find out the trigonometric cosine of an angle.

import math

pi = math.pi
print(math.cos(pi/6))
print(math.cos(pi/4))
print(math.cos(pi/3))

The output of the above code will be:

0.8660254037844387
0.7071067811865476
0.5000000000000001

❮ Python Math Module