Given some space separated list of integers every element appears twice other than one element write a program to find the element which appeared only once
lst = [int(n) for n in input().split()]
while lst:
n = lst.pop(0)
if n in lst:
lst.remove(n)
else:
print(n)
break
Comments
Leave a comment