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('Python') == 6
    assert my_function('Hello World') == 11
    assert my_function('?') == 1

Solution 1

def my_function(a_string):
    return len(a_string)
def my_function(a_string): pass