News for hackers. Stuff that matters.
Re:Stack Overflow: the Blind Leading the Blind by brianr on Sunday August 31, 2008 @09:36PM (#291636)
Here's an example in python:

  >>> import random, operator
  >>> nums = (range(5)*2)
  >>> random.shuffle(nums)
  >>> nums.pop() 
  1
  >>> nums
  [0, 4, 0, 3, 2, 4, 3, 1, 2]
  >>> reduce(operator.xor, nums)
  1
Re:Stack Overflow: the Blind Leading the Blind by thorax on Sunday August 31, 2008 @09:52PM (#291647)
To clarify for non-Pythoners/non-coders: If you assume "nums" already contains the list, most of his code above is setup. You only need these two lines of his code to get the answer:

  import operator
  answer = reduce(operator.xor, nums)