Python Tutorial Python Advanced Python Resources Python Libraries
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

Python - math.acos() Function



The Python math.acos() function returns arc cosine of a value. The return value will be in the range 0 through 𝜋.

Note: acos() is the inverse of cos().

Syntax

math.acos(x)

Parameters

x Required. Specify the value.

Return Value

Returns the arc cosine of the value.

Example:

In the example below, 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(-0.5))
print(math.acos(-1))

The output of the above code will be:

1.0471975511965979
0.0
2.0943951023931957
3.141592653589793

❮ Python Math Module

5