Guess the pattern
Use the test to guess the pattern used by the function and implement it using Python.
Hint: The abs
python function might be handy ;)
Test Cases
test your function - Run Test
def test_your_function():
assert my_function(2) == 4
assert my_function(3) == 6
assert my_function(-1) == 2
assert my_function(-3) == 6
Solution 1
def my_function(x):
return abs(x) * 2