Absolute Value in Python
abs(), also known as absolute value in python. It is a python’s built in function of standard library.
It is used to return an absolute value of input number. It takes only one argument at single time, and returns its absolute value.
It takes three types of value integer, floating point number and complex numbers, based on the types of numbers it gives respective output, for Example.
Integer: – Gives integer absolute value, ignoring negative sign.
Floating: – Gives floating absolute value, ignoring negative sign.
Complex: – Gives magnitude of the number.
Syntax: –
abs(argument)
Note: – the note all alphabets in abs will be lower case including a.
Integer
Output:
Floating point
Output:
Complex numbers
Output: