The acos() method in Python number refers to the library method of its math module and is used to obtain the arc cosine. It accepts a number that lies between -1 to 1 and also returns the arc cosine value (in radians) of the specific number
Here is the syntax for acos() method:
Note - One cannot access this function directly, so it is required to import the math module in Python, and then we are supposed to call this function making use of the math static object.
This method thus returns the arc cosine of x, into radians.
The example below shows the usage of acos() method.
#!/usr/bin/python import math print "acos(0.64) : ", math.acos(0.64) print "acos(0) : ", math.acos(0) print "acos(-1) : ", math.acos(-1) print "acos(1) : ", math.acos(1)
When the above program is run, it produces the following result:
acos(0.64) : 0.876298061168 acos(0) : 1.57079632679 acos(-1) : 3.14159265359 acos(1) : 0.0
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.