Python – Find Tangent – tan() Function with Examples

tan() function is used to find the tangent of x radians in Python for the given input(x – parameter).

 

Syntax of tan() Function

The syntax of tan() function in Python is:

math.tan(x)

 

Parameters of tan() Function in Python

x – Where x is any valid python number (positive or negative). This parameter is required.
Note: If the x parameter is not a number, tan() function will return an Error.

 

Compatibility

tan() function is available and compatible with both Python 2.x and 3.x. This function is a part of python standard math library.

 

Return Value of tan() Function in Python

tan() function returns the tangent of x radians for the given input.

 

Python tan() Function Example

# import math library
import math
print(math.tan(-0.2))
print(math.tan(0))
print(math.tan(0.2))
print(math.tan(77))
print(math.tan(-3677))

Output:

-0.2027100355086725
0.0
0.2027100355086725
-32.268575775934416
-4.19148212972682