Solution 1

def get_element_number(a_list, search_term):
    count = 0
    for item in a_list:
        if item == search_term:
            return count
        count += 1
    return 'no match'

Solution 2

def get_element_number(a_list, search_term):
    count = 0
    for item in a_list:
        if item == search_term:
            break
        count += 1
    else:
        return 'no match'
    return count

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
def get_element_number(a_list, search_term): pass