Answer to Question #265951 in Python for Sreedhar

Question #265951

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

1
Expert's answer
2021-11-14T09:20:54-0500
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS