Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

1.0 KB
Raw Blame

title: Python abs() built-in function - Python Cheatsheet description: Return the absolute value of a number. The argument may be an integer, a floating point number, or an object implementing abs(). If the argument is a complex number, its magnitude is returned.

Python abs() built-in function From the Python 3 documentation Return the absolute value of a number. The argument may be an integer, a floating point number, or an object implementing __abs__(). If the argument is a complex number, its magnitude is returned.
>>> abs(-1)
# 1
>>> abs(0)
# 0
>>> abs(1)
# 1
>>> abs(3.14)
# 3.14
>>> abs(3 + 2j)
# 3.6055512754639896
>>> abs(0x10)
# 16
>>> abs(0b10)
# 2
>>> abs(0o20)
# 16