Python math.cos() Method

❮ Math Methods


Example

Find the cosine of different numbers:

# Import math Library
import math

# Return the cosine of different numbers
print (math.cos(0.00))
print (math.cos(-1.23))
print (math.cos(10))
print (math.cos(3.14159265359))
Try it Yourself »

Definition and Usage

The math.cos() method returns the cosine of a number.


Syntax

math.cos(x)

Parameter Values

Parameter Description
x Required. A number to find the cosine of. If the value is not a number, it returns a TypeError

Technical Details

Return Value: A float value, from -1 to 1, representing the cosine of an angle
Python Version: 1.4

❮ Math Methods

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.