Python Tutorial Python Advanced Python References Python Libraries

Python math - tan() Function



The Python math.tan() function returns trigonometric tangent of an angle (angle should be in radians). In the graph below, tan(x) vs x is plotted.

Tan Function

Syntax

math.tan(x)

Parameters

x Required. Specify the angle in radian.

Return Value

Returns the trigonometric tangent of an angle.

Example:

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

import math

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

The output of the above code will be:

0.5773502691896257
0.9999999999999999
1.7320508075688767

❮ Python Math Module