The Python acos function calculates the trigonometry Arc cosine for the specified expression. The acos or Arc cosine is also called the inverse of a cosine. This section discusses how to use the acos function with an example.
The syntax of the Python acos or arccos Function is
math.acos(number);
Number: It can be a number or a valid numerical expression for which you want to find the Arc cosine value.
- If the number argument is a positive or negative number, the acos function returns the Arc Cosine value.
- If it is not a number, the acos function returns TypeError.
- And if it is outside the range -1 and 1, acos function returns ValueError.
Python acos Function Example
The acos Function allows you to find the trigonometry Arc Cosine for the numeric values. In this acos example, we will find the Arc Cosine values of different data types and display the output.
TIP: Please refer to the Python cos method article from the Python basics page to understand the Cosine Function.
import math
Tup = (0.21, 0.12, 0.39, -0.89 , 0.42) # Tuple Declaration
Lis = [-0.1, 0.92, 0.35, -0.46 , 0.85] # List Declaration
print('Arc Cosine value of Positive Number = %.2f' %math.acos(1))
print('Arc Cosine value of Negative Number = %.2f' %math.acos(-1))
print('Arc Cosine value of Tuple Item = %.2f' %math.acos(Tup[3]))
print('Arc Cosine value of List Item = %.2f' %math.acos(Lis[2]))
print('Arc Cosine value of Multiple Number = %.2f' %math.acos(0.10 + 0.20 - 0.40))
print('Arc Cosine value of String Value = ', math.acos('Python'))

First, we used the acos Function directly on both the Positive integer and negative integer. In the following statements, find the arccos of the corresponding values.
Next, we used the Function on Python Tuple and Python List items. If you observe the screenshot above, the acos function works perfectly on them. Next, we used the acos() method from the list of math functions on multiple values.
Within the last statement, we tried the acos Function on the String value, which returns a TypeError. Please refer to the Python asin and Python atan methods from the list of Python math functions to find the arc sine and arc tangent values.