Python abs () function

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_29720657/article/details/102759089

description:

Python abs () returns the absolute value of the function number for

grammar:

abs(x)

Parameter Description:

x --- numerical expressions. Parameter can be integer or floating point. If the argument is complex, and its size is returned. If x is defined abs, abs (x) returns x.

return value:

Returns the absolute value of number.

The following example shows ABS () function to use

print(abs(-48))
print(abs(48))
print(abs(-100.1))
print(abs(7+5J)) #复数,返回其大小

Export

48
48
100.1
8.602325267042627

This issue abs () function will learn here.

Guess you like

Origin blog.csdn.net/qq_29720657/article/details/102759089