In this HackerRank Set .union() problem solution The students of District College have subscriptions to English and French newspapers. Some students have subscribed only to English, some have subscribed to only French and some have subscribed to both newspapers.

You are given two sets of student roll numbers. One set has subscribed to the English newspaper, and the other set is subscribed to the French newspaper. The same student could be in both sets. Your task is to find the total number of students who have subscribed to at least one newspaper.

HackerRank Set .union() Operation in python problem solution

HackerRank Set .union() Operation in python problem solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
n=input()
s1=set(map(int, raw_input().split()))
n=input()
s2=set(map(int, raw_input().split()))
print len(s1.union(s2))