The abs() function is used to return the absolute value of a number.
abs(number) number : Can be integer, a floating point number or a complex number
The abs() takes only one argument, a number whose absolute value is to be returned. The argument can be an integer, a floating point number or a complex number.
- If the argument is an integer or floating point number, abs() returns the absolute value in integer or float.
- In case of complex number, abs() returns only the magnitude part and that can also be a floating point number.
Absolute value of integer is: 54.26 Absolute value of float is: 94 Absolute value or Magnitude of complex is: 5.0
- Important differences between Python 2.x and Python 3.x with examples
- Python | Sort Python Dictionaries by Key or Value
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | a += b is not always a = a + b
- max() and min() in Python
- Python Set | pop()
- SHA in Python
- pow() in Python
- SQL using Python | Set 1
- Use of min() and max() in Python
- zip() in Python
- bin() in Python
- set add() in python
- chr() in Python
- try and except in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.