Starting from today, I will update a python function every day, along with examples and points to note when using the function. I named this function topic "Daily Lecture on Python Functions". I hope everyone will support it. Haha
Starting below, today’s function is abs()
First read the official English document explanation
abs(x)
Return the absolute value of a number. The argument may be a plain or long integer or a floating point number. If the argument is a complex number, its magnitude is returned.
Detailed explanation:
returns the absolute value
The parameter can be: negative number, positive number, Floating point number or long integer
Example:
abs(-1.2) #返回 1.2 abs(1.2) #返回 1.2 abs(-11216.5) #返回 11216.5 abs(11216.5) #返回 11216.5
Note: The parameter can be a negative number or a positive number. Only the absolute value will be taken and no rounding will be done.