Hi, I am a newbie here and a python newbie as well :) I am having trouble implementing a program in which you must use only recursive functions and no built-in python functions other than the len function in order to determine if there are duplicates of an item in a given list. The function returns True if there is and False if there isn't. The base condition would be if there is nothing in the list (hence the use of the len function). What I am having trouble with here, is how do you take an item and compare it to the other items in the list to see if they are equal, and if not, discard that item and continue this type of searching? Using only recursive functions? Or is there something else I must do to check for duplicates?
I suppose the general question here would be for example:
Given a list L that is [1,2,3,4,5,1,6], how could I use recursive functions to check if the first index of the list (in this case, 1) is equal to any other indexed item in this list? And if not, discard the first index and make the next index the first index (index 0)? If this is not possible, what is a workaround that provides the result im looking for?
Edited 6 Years Ago by johni12: n/a