# Python tanh

Python tanh math function calculates trigonometric hyperbolic tangent of a given expression. The syntax of the tanh Function is

`math.tanh(number);`

Number: It can be a number or a valid numerical expression for which you want to find hyperbolic Tangent value. If it is not a number, the tanh function returns TypeError.

## Python tanh Function Example

The Python tanh Function allows you to find the trigonometric Hyperbolic tangent for numeric values. In this tanh example, we are going to find the hyperbolic tangent values for different data types and display the output

First, we used the Python tanh Function directly on both the Positive integer and negative integer. The following statements find the hyperbolic Tangent of the corresponding values.

Next, We used the tanh Function on Tuple and List items. If you observe the above screenshot, the Math function is working perfectly on them. Next, We used it directly on multiple values.

Within the last statement, we tried on the String value, and it returns TypeError.

TIP: Please refer to the tan article to understand the Tangent Function.

```import math

Tup = (1, 2, 3, -4.5 , 5)
Lis = [-1, 2, 3.5, -4 , 5]

print('Hyperbolic Tangent value of Positive Number = %.2f' %math.tanh(1))
print('Hyperbolic Tangent value of Negative Number = %.2f' %math.tanh(-2))

print('Hyperbolic Tangent value of Tuple Item = %.2f' %math.tanh(Tup))
print('Hyperbolic Tangent value of List Item = %.2f' %math.tanh(Lis))

print('Hyperbolic Tangent of Multiple Numbers = %.2f' %math.tanh(2 + 9 - 7))

print('Hyperbolic Tangent value of String Value = ', math.tanh('Hello'))```