English documents:
ABS (x)
Return the absolute value of a number. The argument is a integer or a floating point number. If The argument is a complex number, it magnitude is returned
Description
1. Returns the absolute value of a number, which can be an integer, floating-point, or plural
2. If the argument is a complex number, this method returns the absolute value of this complex number (the square root of the product of the complex number and its conjugate complex number)
Example:
>>> ABS (34>>>) ABS ( -2) 2>>> abs (0) 0>>> abs (454L) #python3已经没有了 long type, When defined , the File "<stdin>" is automatically recognized, line 1 abs (454L) ^syntaxerror:invalid syntax>>> c1=comples ( Traceback (most recent): File "<stdin>", line 1, in <module>nameerror:name ' comples ' are not de Fined>>> C1=complex >>> C1 (1+1j) >>> ABS (C1) 1.4142135623730951>>>>> > c2 = Complex ( -1,-1) >>> C2 #复数 ( -1-1j) >>> abs (C2) #复数绝对值1 .4142135623730951>>>
Python built-in functions (1)--abs