Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Searching lists while seemingly trivial, can often have some subtle bugs. Your co-worker Liam has written a function find_first that searches a list for a
Searching lists while seemingly trivial, can often have some subtle bugs. Your co-worker Liam has written a function find_first that searches a list for a given value and returns the index of the first occurrence of an item in a list, or -1 if the item is not found. The function can be called in two different ways: find_first(item, data) to start searching at the first element in the list, or find_first(item, data, start_index) to start searching at the given start_index. Please write some tests that would allow you to check if Liam's function (or anyone else's) is correct. Answer: (penalty regime: 0 % Reset answer Test Result print (find first(1, [0, 1, ]))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started