You can download this code by clicking the button below.
This code is now available for download.
Returns the absolute value of a given number. If the number is negative, it returns its opposite; otherwise, it returns the number itself.
Technology Stack : Built-in function
Code Type : Function
Code Difficulty :
def abs_value(num):
if num < 0:
return -num
return num