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(9) == 4.5
    assert my_function(10) == 5
    assert my_function(1) == 0.5

Solution 1

def my_function(x):
    return x / 2.0  # We must use 2.0 if using Python 2. Py 3 can be just 2
def my_function(x): pass