Tutorials Point


  Python Basics
  Python Advanced
  Python Useful References
  Python Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Python Number abs() Function


previous next AddThis Social Bookmark Button


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:

  • x: This is a numeric expression.

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 Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names