上QQ阅读APP看书,第一时间看更新
abs
The abs function's name stands for absolute. As you may expect, it returns an absolute (positive) representation of the passed number by removing the negative sign, if there is one. For example, if we pass -1 or 1 as an argument, we'll get 1 as a result, as you can see in the following code:
>>> abs(-1)
1
>>> abs(1)
1
Another function is round, and it is also easy to guess what this does