Solution 1

def count_elems_with_s(list_of_treasure):
    count = 0
    for treasure in list_of_treasure:
        if 's' in treasure:
            count += 1
    return count

Count Elements with 's'

Complete the function count_elems_with_s so that it uses a for loop to go through each
item in list_of_treasure.

If the letter 's' is in the item, keep count of it.

Return the final count of items that contain the letter 's'.

Test Cases

test count elems with s - Run Test

def test_count_elems_with_s():
    assert count_elems_with_s(["gold", "silver", "bronze", "steel", "soup"]) == 3
def count_elems_with_s(list_of_treasure): pass