Python Program For Abs Built In Function

Python abs() function:

 

  • Returns absolute value.
  • Converts negative number to positive number.

 


 

 


 

abs() Syntax:

Syntax

abs(value)

 


 

01. Example

num = -100
abs(num)

Output:

100

 


 

02. Example

num = 23.33
abs(num)

Output:

23.33

 


 

03. Example

x = abs(3+4j)
print(x)

Output:

5.0

 


 

Leave a comment