Python math.cos()
Published May 19, 2021Updated Mar 17, 2024
Contribute to Docs
The math.cos() function returns the cosine of an angle.
Syntax
math.cos(n)
The math.cos() function returns a numeric value between -1 and 1, which represents the cosine of the value n.
Example
Use math.cos() to return the cosine of a 90 degree angle:
import mathprint(math.cos(90))
The above code gives the following output:
-0.4480736161291702
Codebyte Example
Run the following example that uses the math.cos() function to understand its working:
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve 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