Input Format
The first line of input contains an integer, .
The second line contains  space-separated integers.
The third line contains an integer, .
The fourth line contains  space-separated integers.
Output Format
Output the symmetric difference integers in ascending order, one per line.

hackerrank symmetric difference problem solution in python programming

Problem solution in Python 3 programming language.

# Enter your code here. Read input from STDIN. Print output to STDOU
M = input();m = input().split()
N = input();n = input().split()

print("\n".join(sorted(list(set(m) ^ set(n)),key=int)))

Second solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
a,b = [set(input().split()) for _ in range(4)][1::2]
print('\n'.join(sorted(a^b, key=int)))

Problem solution in Python 2 programming language.

# Enter your code here. Read input from STDIN. Print output to STDOU
M = raw_input();m = raw_input().split()
N = raw_input();n = raw_input().split()

print "\n".join(sorted(list(set(m) ^ set(n)),key=int))