Python abs() function

Here I’ll tell you about python abs() built-in function. Its actually return the the absolute value of any given number.

Note: absolute of -5 will be 5

 

Syntax:

The syntax of python abs() function is

 

Parameter:

abs() function takes single parameter

  • num: it is number, whose absolute we want to find

 

check the example below to understand

 

Example#1

absolute value of -17.3

Output/Results

 

 

Example#2

absolute value of  7 – 12

Output/Results

 

 

Example#3

absolute value of  a complex number

Output/Results

 

 

Get More Python Tutorials