Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python acos() function

Python acos() function

Python Numbers Python Numbers


Description

acos() Returns the arc cosine of x in radians.


Syntax

The syntax of the acos() method is as follows:



import math



math.acos(x)

**Note:** acos() cannot be accessed directly; you need to import the math module and call the method through the static math object.


Parameters


Return Value

Returns the arc cosine of x in radians.


Example

The following shows examples of using the 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)

Running the example above produces:



acos(0.64) :  0.876298061168

acos(0) :  1.57079632679

acos(-1) :  3.14159265359

acos(1) :  0.0

Python Numbers Python Numbers