In this HackerRank Symmetric Difference problem solution, you are Given 2 sets of integers, M and N, print their symmetric difference in ascending order. The term symmetric difference indicates those values that exist in either M or N but do not exist in both.


HackerRank Symmetric Difference in python problem solution


HackerRank Symmetric Difference problem solution

import fractions
#Use these to get params
n = int(raw_input().strip())
set1 = set(int(i) for i in raw_input().strip().split())
n = int(raw_input().strip())
set2 = set(int(i) for i in raw_input().strip().split())
for i in sorted(list(set1.difference(set2)) + list(set2.difference(set1))):
    print i