2 Make Absolute Value Function Using Statement Abs 5 5 Abs 23 23 Q37205438

In Python

2. Make your own absolute value function, using an if statement: abs (-5)5 abs (23)23

2. Make your own absolute value function, using an if statement: abs (-5)5 abs (23)23 Show transcribed image text 2. Make your own absolute value function, using an if statement: abs (-5)5 abs (23)23


Answer


def abs(n): if n < 0: return -1 * n else: return nprint(abs(-5))print(abs(23))

23 Process finished with exit code 0

23 Process finished with

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.