  # Python Number Tan() Method

Show

## Description

In Python programming, the math module consists of a number of mathematical operations that can be performed easily making use of the module. The math function tan() function is supposed to return the tangent of the value which is passed as an argument. The value which is passed in this function must be in radians. The Python number method tan() thus returns the tangent of x radians.

### Syntax

Here is the syntax for tan(x) method:

`tan(x)`

Note - One cannot access this function directly, so it is required to import the math module in Python, and then we are supposed to call this function making use of the math static object.

### Parameters

• x - This must be a numeric value.

#### Return Value

This method in the Python math module returns a numeric value that lies between -1 and 1, and represents the tangent of the specified parameter x.

Example

The example below shows the usage of tan() method.

```#!/usr/bin/python
import math

print "tan(3) : ",  math.tan(3)
print "tan(-3) : ",  math.tan(-3)
print "tan(0) : ",  math.tan(0)
print "tan(math.pi) : ",  math.tan(math.pi)
print "tan(math.pi/2) : ",  math.tan(math.pi/2)
print "tan(math.pi/4) : ",  math.tan(math.pi/4)```

When we run the above program, it produces the following result:

```tan(3) :  -0.142546543074
tan(-3) :  0.142546543074
tan(0) :  0.0
tan(math.pi) :  -1.22460635382e-16
tan(math.pi/2) :  1.63317787284e+16
tan(math.pi/4) :  1.0```

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.