Input Format
The first line contains the number of students who have subscribed to the English newspaper.
The second line contains the space separated list of student roll numbers who have subscribed to the English newspaper.
The third line contains the number of students who have subscribed to the French newspaper.
The fourth line contains the space separated list of student roll numbers who have subscribed to the French newspaper.
Constraints
Output Format
Output total number of students who have subscriptions to the English or the French newspaper but not both.

hackerrank set symmetric difference operation problem solution in python

Problem solution in Python 3 programming language.

E = int(input())
English = set(input().split())

F = int(input())
French = set(input().split())

print(len(English ^ French))

Second solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
_, a = input(), set(input().split())
_, b = input(), set(input().split())
print(len(a.symmetric_difference(b)))

Problem solution in Python 2 programming language.

E = int(raw_input())
English = set(raw_input().split())

F = int(raw_input())
French = set(raw_input().split())

print len(English ^ French)