Problem statement
-https://www.hackerrank.com/challenges/sets
Program – Python 3
Program – Python 3
if int(input()) >
0 :
x =
set(list(map(int,input().split())))
if int(input())
> 0:
y =
set(list(map(int,input().split())))
z =
sorted(x.symmetric_difference(y))
for i in z:
print(i)
sets – sets are unordered collection of items. Every element is unique (no duplicates) !!
map() -> map will perform the particular action/function on a list of values.Here it converts to int.
symmetric_difference () -> is function of sets which will return the elements which are unique in X and Y but not in both sets .
Ex – x.symmetric_difference(y)
Comments