Python math.tan() Method

Python math 模块Python math Module

Python math.tan(x)Returns the tangent of x radians.

Python Version: 1.4

Syntax

The syntax of math.tan() is as follows:

math.tan(x)

Parameter description:

  • x-- Required, a number. If x is not a number, it returns TypeError.

Return Value

Returns a float representing the tangent of x.

Example

The following example returns the tangent of a number:

Example

# Import the math package
import math

# Output the tangent value
print (math.tan(90))
print (math.tan(-90))
print (math.tan(45))
print (math.tan(60))

Output result:

-1.995200412208242
1.995200412208242
1.6197751905438615
0.3200403893795629

Python math 模块Python math Module

Other Extensions