[Solved] Find a unique element in a list [closed]
You can use reduce (functools.reduce in Python3) if the integer is non-zero >>> x = [False, False, False, 10, False, False] >>> reduce(lambda i,j:i or j, x) 10 You can use a generator expression also here >>> x = [False, False, False, 10, False, False] >>> (i for i in x if i!=False).next() 10 Also … Read more