Question: Write a function that finds all occurrence of a specific value in a list, and records--in a separate list--these occurrences in terms of the indices

Write a function that finds all occurrence of a specific value in a list, and records--in a separate list--these occurrences in terms of the indices where they were found. Your function should be named find_all take 2 arguments: a list of items, and a single element to search for in the list returns 1 list a list of indices into the input list that correspond to elements in the input list that match what we were looking for For example, find all([1, 2, 3, 4, 5, 2], 2) would return [1, 5]. find_all([1, 2, 3], 0) should return [] You cannot use any built-in functions besides len() and range(). Graded Read Only ]: 11 [1, 2, 3, 4, 5, 2] s1 = 2 al = [1, 5] assert set(al) set(find_all(11, s1)) == "problem" ] Read Only ]: 12 - ["a", "random", "set", "of", "strings", "for", "an", "interesting", "strings", 52 = "strings" a 2 [4, 8] assert set(a2) set(find_all(12, $2)) Read Only 13 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] S3 = 1001 a3 = [] assert set (3) set(find_all(13, 53))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
