We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def sym_diff():
s1=input()
a=input()
a1=a.split(" ")
set1={int(i) for i in a1}
s2=input()
b=input()
a2=b.split(" ")
set2={int(i) for i in a2}
return sorted(set1-set2| set2 - set1)
op=sym_diff()
for i in op:
print(i)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Symmetric Difference
You are viewing a single comment's thread. Return to all comments →
def sym_diff(): s1=input() a=input() a1=a.split(" ") set1={int(i) for i in a1} s2=input() b=input() a2=b.split(" ") set2={int(i) for i in a2} return sorted(set1-set2| set2 - set1) op=sym_diff() for i in op: print(i)