PythonNumberabs

Returns the absolute value of a number.

Syntax

abs(x)

Example

Enter values below to update the example in real time.

print
print(abs(-5))      # 5
print(abs(-3.7))    # 3.7
print(abs(0))       # 0