lists=['word','word',5,5,4,5,5,5] def remove_duplicates(lists): for i in lists: while lists.count(i)>1: lists.remove(i) return lists print lists print remove_duplicates(lists)
Oops, try again. Your remove_duplicates modifies the list that was passed to it. [4, 5, 5, 4] was modified to [5, 4]. Perhaps you should make a copy first!
the output is correct but i still get the error message!???