algorithm design and recursion simple searching problem to make the discussion of searching algorithms as simple as possiblelet' boil the problem down to its essence here is the specification of simple searching functiondef search(xnums)nums is list of numbers and is number returns the position in the list where occurs or - if is not in the list here are couple interactive examples that illustrate its behaviorsearch( [ ] search( [ ]- in the first examplethe function returns the index where appears in the list in the second examplethe return value - indicates that is not in the list you may recall from our discussion of list operations that python actually provides number of built-in search-related methods for examplewe can test to see if value appears in sequence using in if in numsdo something if we want to know the position of in listthe index method fills the bill nicely nums [ , , , , nums index( in factthe only difference between our search function and index is that the latter raises an exception if the target value does not appear in the list we could implement search using index by simply catching the exception and returning - for that case def search(xnums)tryreturn nums index(xexceptreturn - this approach avoids the questionhowever the real issue is how does python actually search the listwhat is the algorithm