#import the cmath module
import cmath

#print the hyperbolic tangent of a radian angle

The cmath.tanh() function calculates the hyperbolic tangent of a complex number given in radians.

x The radian complex angle whose hyperbolic tangent is to be calculated. The value should be numerical value, either real or complex. If the value is a real number, it is first converted into a complex value before the operation.

The function returns a complex number representing the hyperbolic tangent of the input complex value, x

import cmath

print(cmath.tanh(0.5 + 1j))
print(cmath.tanh(0.23 + 1.24j))