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!
I don't see where the original argument (elements) is being modified, unless "unduped = elements" just creates unduped as a pointer to elements or something?
def remove_duplicates(elements): unduped = elements for u in unduped: while unduped.count(u) > 1: unduped.remove(u) return unduped