To walk through the four steps discussed in class: 1. Function header and doc string: rec_in(some_list, item) """Return True if item is contained in some_list, False otherwise""" 2. Recusive case: Imagine that you have a working version of rec_in, however, you can only call it on smaller versions of your problem (in this case) a smaller list, how could we solve the problem? Check the first thing in the list to see if it matches the item, if it does, return True. Otherwise, check the rest of the list with our recursive function. 3. Base case: if the list is empty, then the item isn't in the list 4. Put it all together: def rec_in(some_list, item): """Return True if item is contained in some_list, False otherwise""" if len(some_list) == 0: return False else: if some_list[0] == item: return True else: return rec_in(some_list[1:], item) If you want to get fancy, a shorter version of this is: def rec_in(some_list, item): """Return True if item is contained in some_list, False otherwise""" if len(some_list) == 0: return False else: return some_list[0] == item or rec_in(some_list[1:], item) Or even fancier: def rec_in(some_list, item): """Return True if item is contained in some_list, False otherwise""" return len(some_list) > 0 and (some_list[0] == item or rec_in(some_list[1:], item)) For the curious: The reason these fancier versions with "or" and "and" work is that these boolean operators work like "if" statements: To evaluate A or B python does the following: if A==True return True else return B Similarly, to evaluate A and B python does the following: if A==False return False else return B This is called "short-circuit" evaluation since B is never evaluated if the result of the expression is already known after evaluating A.