What does abs mean in python
The abs() function in python returns the absolute value of a number.
Syntax
The following is the syntax of the abs() method:
abs( x )
Parameters
x --Numeric expression.
Return value
The function returns the absolute value of x (number).
Example
The following shows an example of using the abs() method:
#!/usr/bin/python print "abs(-45) : ", abs(-45) print "abs(100.12) : ", abs(100.12) print "abs(119L) : ", abs(119L)
The output result after running the above example is:
abs(-45) : 45 abs(100.12) : 100.12 abs(119L) : 119
Related recommendations: " Python Tutorial》
The above is the detailed content of What does abs mean in python. For more information, please follow other related articles on the PHP Chinese website!