Solution 1

def my_function(x):
    return x * -1

Guess the pattern

Use the test to guess the pattern used by the function and implement it using Python.

Test Cases

test your function - Run Test

def test_your_function():
    assert my_function(1) == -1
    assert my_function(2) == -2
    assert my_function(3) == -3
    assert my_function(5) == -5