Easy Tutorial
❮ Ref Math Ldexp Ref Math Sinh ❯

Python3 abs() Function

Python3 Numbers


Description

The abs() function returns the absolute value of a number.


Syntax

Here is the syntax for the abs() method:

abs( x )

Parameters


Return Value


Examples

Below are examples demonstrating the use of the abs() method:

#!/usr/bin/python3

print("abs(-40) : ", abs(-40))
print("abs(100.10) : ", abs(100.10))

The output of the above examples is:

abs(-40) :  40
abs(100.10) :  100.1

Related Articles:

Python3 Numbers

❮ Ref Math Ldexp Ref Math Sinh ❯