Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs

Python acos

by suresh

The Python acos function calculates the trigonometry Arc cosine for the specified expression. Python acos or Arc cosine also called the inverse of a cosine. In this section, we discuss how to use acos function in Python with example.

The syntax of the acos Function in Python Programming Language is

math.acos(number);

Number: It can be a number or a valid numerical expression for which you want to find 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 Python acos Function allows you to find the trigonometry Arc Cosine for the numeric values. In this acos example, we are going to find the Arc Cosine values of different data types and display the output.

# Python ACOS 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'))
Python ACOS Function

First, we used the acos Function directly on both the Positive integer and negative integer. The following statements find the Arc Cosine of the corresponding values.

print('Arc Cosine value of Positive Number = %.2f' %math.acos(1))
print('Arc Cosine value of Negative Number = %.2f' %math.acos(-1))

Next, We used the acos Function on Tuple and List items. If you observe the above screenshot, the acos function is working perfectly on them.

print('Arc Cosine value of Tuple Item = %.2f' %math.acos(Tup[3]))
print('Arc Cosine value of List Item = %.2f' %math.acos(Lis[2]))

Next, We used the acos Math function on multiple values.

print('Arc Cosine value of Multiple Number = %.2f' %math.acos(0.10 + 0.20 - 0.40))

Within the last statement, we tried the acos Function on the String value, and it returns TypeError.

print('Arc Cosine value of String Value = ', math.acos('Python'))

Please refer to the Python cos Function article to understand the Python Cosine Function.

Placed Under: Python

  • Download and Install Python
  • Python Arithmetic Operators
  • Python Assignment Operators
  • Python Bitwise Operators
  • Python Comparison Operators
  • Python Logical Operators
  • Python If Statement
  • Python If Else
  • Python Elif Statement
  • Python Nested If
  • Python For Loop
  • Python While Loop
  • Python Break
  • Python Continue
  • Python Dictionary
  • Python datetime
  • Python String
  • Python Set
  • Python Tuple
  • Python List
  • Python List Comprehensions
  • Python Lambda Function
  • Python Functions
  • Python Types of Functions
  • Python Iterator
  • Python File Handling
  • Python Directory
  • Python Class
  • Python classmethod
  • Python Inheritance
  • Python Method Overriding
  • Python Static Method
  • Connect Python and SQL Server
  • Python SQL Create DB
  • Python SQL Select Top
  • Python SQL Where Clause
  • Python SQL Order By
  • Python SQL Select Statement
  • Python len Function
  • Python max Function
  • Python map Function
  • Python print Function
  • Python sort Function
  • Python range Function
  • Python zip Function
  • Python Math Functions
  • Python String Functions
  • Python List Functions
  • Python NumPy Array
  • NumPy Aggregate Functions
  • NumPy Arithmetic Operations
  • Python Numpy Bitwise operators
  • Numpy Comparison Operators
  • Numpy Exponential Functions
  • Python Numpy logical operators
  • Python numpy String Functions
  • NumPy Trigonometric Functions
  • Python random Array
  • Python numpy concatenate
  • Python numpy Array shape
  • Python pandas DataFrame
  • Pandas DataFrame plot
  • Python Series
  • Python matplotlib Histogram
  • Python matplotlib Scatter Plot
  • Python matplotlib Pie Chart
  • Python matplotlib Bar Chart
  • Python List Length
  • Python sort List Function
  • Python String Concatenation
  • Python String Length
  • Python substring
  • Python Programming Examples

Copyright © 2021 · All Rights Reserved by Suresh

About Us | Contact Us | Privacy Policy