Solution 1

def get_search_match_indexes(list_being_frisked, search_term):
    list_of_matching_indexes = []
    index = 0
    for item in list_being_frisked:
        if item == search_term:
            list_of_matching_indexes.append(index)
        index += 1
    return list_of_matching_indexes

Get Search Match Indexes

It's time to search our list_being_frisked for "suspicious" items. We want you to
return the a new list containing the indexes of any items that match the string "suspicious".

Hint: You'll need to keep track of the index and create a new list to store the indexes in.

Good luck! You wanted to work for the TSA, right?

Test Cases

test get search match indexes - Run Test

def test_get_search_match_indexes():
    assert get_search_match_indexes(["glasses", "suspicious", "pen", "suspicious"], "suspicious") == [1, 3]
def get_search_match_indexes(list_being_frisked, search_term): pass