Member-only story

Python: Abs Function Tutorial

Jesse L
Dec 16, 2021

--

Hi everyone, welcome back. Today, we will be going over the abs() function in Python and see how it works. The abs() function is a built in function and its purpose is to return an absolute value of a given number. Let’s get into it.

Abs Function

Let’s see how the abs() function works:

result = abs(-3.5)
print(result)
Output:
3.5

As we can see in the example above, we requested for the absolute value of -3.5 and our abs() function returned a value of 3.5, which is our expected result.

Conclusion

This is it for the abs() function example. It’s a fairly straight forward function that returns an absolute value of a given number. I hope this helps. Thanks for reading.

--

--

Jesse L
Jesse L

Written by Jesse L

Hi, I'm a passionate technology enthusiast and lifelong learner. Beyond my technical pursuits, I'm also passionate about sharing my enthusiasm with others.

No responses yet