Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python: Jupiter Exercise 2 Write a function called isin) that takes two paramete

ID: 3757103 • Letter: P

Question

Python: Jupiter

Exercise 2 Write a function called isin) that takes two parameters (a list of strings, and a string to search for in the list) and returns the index position of the found item if it is in the list, and -1 otherwise Hint: are there are any built-in Python methods for working with lists that you might be able to use? You might also use a loop of some kind In [ ]: # Define function in this cell In [ ]: # Edit the code here to call your function in this cell to-search [ ] found_index -

Explanation / Answer

def isin(lst, item): for i in range(len(lst)): if lst[i] == item: return i return -1 to_search = [] found_index = isin(to_search, '')