Python - Math acos() Function
The Python Math acos() function is used to return arc cosine of a value. The return value will be in the range 0 through 𝜋.
Note: acos() is the inverse of cos().
Syntax
acos(x)
Parameters
x |
Required. Specify the value. |
Return Value
Returns the arc cosine of the value.
Example:
In the below example, acos() function is used to find out the arc cosine of a given value.
import math print(math.acos(0.5)) print(math.acos(1)) print(math.acos(2))
The output of the above code will be:
1.0471975511965979 0.0 ValueError: math domain error
❮ Python Math Module