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

Python math.acos() Method

Python math.acos() Method

Python math Module Python math Module

Python math.acos(x) Returns the arc cosine of x, with the result in the range 0 to pi.

math.acos() accepts arguments from -1 to 1.

math.acos(-1) returns the math.pi constant.

Python version: 1.4

Syntax

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

math.acos(x)

Parameter Description:

Return Value

Returns a floating-point number representing the arccosine of a number.

Example

The following example returns the arccosine of specified numbers:

Example

Import the math package

import

math

Output the arccosine values

print

(

math

.

acos

(

0.55

)

)

print

(

math

.

acos

(

0.55

)

)

print

(

math

.

acos

(

0

)

)

print

(

math

.

acos

(

1

)

)

print

(

math

.

acos

(

1

)

)

Output result:


0.9884320889261531
2.15316056466364
1.5707963267948966
0.0
3.141592653589793

Python math Module Python math Module