Python math.tan()

ishg-153's avatar
Published Jun 22, 2021Updated Mar 17, 2024
Contribute to Docs

Returns the tangent of input numeric x, measured in radians.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours

Syntax

math.tan(x)

Example 1

Use math.tan() to return the tangent of the integer 5 measured in radians:

import math
print(math.tan(5))

The above code gives the following output:

-3.380515006246586

Use math.tan() to return the tangent of the float 5.5 measured in radians:

import math
print(math.tan(5.5))

The above code gives the following output:

-0.995584052213885

Codebyte Example

Run the following example that uses the math.tan() function to understand its working:

Code
Output

All contributors

Contribute to Docs

Learn Python on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours