Skip to content

List Occurrences

Andrew Burke edited this page Apr 3, 2024 · 5 revisions
def find_all_occurrences(lst, target):
    indices = []
    for i in range(len(lst)):
        if lst[i] == target:
            indices.append(i)
    return indices
Clone this wiki locally