Return Value:

It will return the absolute value for the given number.

If the input is an integer, the return value also will be an integer. If the input is a float, the return value will also be float. If the input is a complex number, the return value will be the magnitude of the input.

Examples:

Code Example 1: Integer and Float number

To get the absolute value of an integer and float number check this code: Output:

Example 2: Complex Number

To get absolute value of complex number Output:

Summary:

Abs() is a built-in function available with python, and it will return you the absolute value for the input given. Value is an input value to be given to abs() to get the absolute value. It can be an integer, a float, or a complex number. The abs() method takes one argument, i.e. the value you want to get the absolute. The abs function returns the absolute value for the given number.