Copyright © tutorialspoint.com

Python Number abs() Function

previous next


Description:

This function returns absolute value of x - the (positive) distance between x and zero.

Syntax:

abs( x )

Parameters:

Here is the detail of parameters:

Return Value:

The absolute value of x.

Example:

#!/usr/bin/python

print "abs(-45) : ", abs(-45)
print "abs(100.12) : ", abs(100.12)
print "abs(119L) : ", abs(119L)

This will produce following result:

abs(-45) :  45
abs(100.12) :  100.12
abs(119L) :  119

previous next

Copyright © tutorialspoint.com