A problem with the debugger


#1




it should work, but it wont. the debugger has bugs. ichecked with another interpter and it worked. how would i reprot it?


def remove_duplicates(withDup) :
    withDup.sort()
    single = []
    single.append(withDup[0])
    temp = withDup[0]
    for num in withDup :
        if num != temp :
            single.append(num)
        temp = num
    return single


#2

@itamarfeig ,

Your remove_duplicates function modifies the original list that is passed to it, which Codecademy does not want it to do. That is one reason why it is not accepted as a solution. In addition to that, the function raises an error if it is passed an empty list, because here you assume there is at least one item in the list ...

single.append(withDup[0])

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.