solutions

Search for string

Define a function search_for_string that receives a list and a search term.
Use a loop to go through the list and see if the string is there. If it is,
return 'string found!'. If not, return 'string not found'

Examples:

>>> search_for_string(['santiago', 'santi', 'santa'], 'santa')
'string found!''
>>> search_for_string(['a', 'b', 'c'], 'd')
'string not found'
>>> search_for_string([], 'a')
'string not found'

Test Cases

test empty list - Run Test

def test_empty_list():
    assert search_for_string([], 'a'), 'string not found'

test string present - Run Test

def test_string_present():
    assert search_for_string(['a', 'b', 'c'], 'd') == 'string not found'

test string in list - Run Test

def test_string_in_list():
    assert search_for_string(['santi', 'santa'], 'santa') == 'string found!'