#6 · Python Basics · Beginner · 35 XP · about 4 min
Write a function called absolute(n) that returns the absolute value of a number (without using Python's built-in abs() function).
The absolute value of a number is its distance from zero, always positive.
absolute(5) # Returns 5 absolute(-5) # Returns 5 absolute(0) # Returns 0 absolute(-100) # Returns 100
abs() functionFirst solves only, ranked by stars and then time.