solutions

Get element number

Define a function get_element_number that receives a list of strings and a
term. Use a loop to go through the list of strings and find the search term.
Return the element number of the first match and 'no match' if there is no
match.

Examples:

>>> get_element_number(['a', 'b', 'c'], 'c')
2
>>> get_element_number(['a', 'a', 'a'], 'a')
0
>>> get_element_number(['a', 'b', 'c'], 's')
'no match'

Test Cases

test no match - Run Test

def test_no_match():
    assert get_element_number(['a', 'b', 'c'], 's') == 'no match'

test normal case - Run Test

def test_normal_case():
    assert get_element_number(['a', 'b', 'c'], 'c') == 2

test repeated term - Run Test

def test_repeated_term():
    assert get_element_number(['a', 'a', 'a'], 'a') == 0