# Python math.tan() – Tangent Function

Contents

## Python math.tan()

math.tan(x) function returns the tangent of x radians.

The return value lies in [-inf, inf].

### Syntax

The syntax to call tan() function is

``math.tan(x)``

where

### Examples

In the following example, we find the tangent of 0.5 radians using tan() function of math module.

Python Program

``````import math

result = math.tan(x)
print('tan(x) :', result)``````
Run Code Copy

Output

``tan(x) : 0.5463024898437905``

We can take angle in degrees and convert the degrees into radians using math.radians() function, and then find the tangent of this angle.

In the following program, we find the tangent of 60 degrees.

Python Program

``````import math

x = 60 #degrees
result = math.tan(x)
print('tan(x) :', result)``````
Run Code Copy

Output

``tan(x) : 1.7320508075688767``

### Summary

In this Python Examples tutorial, we learned the syntax of, and examples for math.tan() function.

## Related Tutorials

Code copied to clipboard successfully 👍